CONDITIONAL QUESTION

Questions and answers on how to get the most out of FFAStrans
admin
Site Admin
Posts: 1696
Joined: Sat Feb 08, 2014 10:39 pm

Re: CONDITIONAL QUESTION

Post by admin »

Hi artjuice,

For reference I use https://regex101.com/ with PCRE2 (PHP >=7.3) when I test my regexes. So this is a good start so you know your regex is corret. And as @emcodem points out, you don't need the regext start/stop slashes. However, you do need to set if you want case insensitive in the regex function. So your correct function would be: $regext("%s_original_name%","(?i)^dgtl_"). However, this function will extract the string as opposed to testing if it matches.
To test, just add a single conditional node and submit the source to it. Take a look at the two tests below. They do the exact same thing but with two different approaces. You CAN use both just for the heck of it but I think the first one match your usecase best.
regex.jpg
regex.jpg (58.9 KiB) Viewed 2096 times
Hope this helps :-)

-steinar
artjuice
Posts: 49
Joined: Mon Mar 20, 2023 11:33 pm

Re: CONDITIONAL QUESTION

Post by artjuice »

@steinar

Yes, it's help - this is what im looking for, this will help me to do more complexed conditionals with prefix, suffix and naming.
Thx!!!

But i find that %s_original_name% is read from file that monitored at the beginning of a WF, and i try to use $fname(%s_source%) from previous node in this case it's delivery, becouse at this point name and format are different from that on beginning, and i need to work with source of this point.
emcodem
Posts: 1855
Joined: Wed Sep 19, 2018 8:11 am

Re: CONDITIONAL QUESTION

Post by emcodem »

Just as sidenote, i would normally use the first line from steinar in a conditional, with one difference.
Instead of (?i)^dgtl_
I would probably use ^dgtl_|^DGTL_ but just because it is easier to read for me, functionally it is the same and the upper solution is more slick.
emcodem, wrapping since 2009 you got the rhyme?
artjuice
Posts: 49
Joined: Mon Mar 20, 2023 11:33 pm

Re: CONDITIONAL QUESTION

Post by artjuice »

@emcodem

Thx!
For now a have only one question - how to findout filename of s_source from previous node.
$fname(%s_source%) don't work as expected, or again - i do something wrong.
1st regex match of "$fname(%s_source%) = (?i)^dgtl_" is "$fname(\\ffast1\ffas_jobs\test_j\dgtl_1702.mxf) = (?i)^dgtl_"
2025-02-25_Remote Desktop Manager-005706.png
2025-02-25_Remote Desktop Manager-005706.png (65.99 KiB) Viewed 2052 times
emcodem
Posts: 1855
Joined: Wed Sep 19, 2018 8:11 am

Re: CONDITIONAL QUESTION

Post by emcodem »

wrong:

Code: Select all

$fname(%s_source%)
correct:

Code: Select all

$fname("%s_source%")
emcodem, wrapping since 2009 you got the rhyme?
Post Reply