I have a similar question / problem.
I'm sure it's quite easy but new to regular expressions.
I'd like to extract from %_filename% certain patterns (a code) and assign them to %subtitle%
Examples:
1985-07-14 S-1972
1991-12-22 - PN-42
Shortwave VF-759
In the above example, I'd like to extract the S-1972, PN-42, and VF-759.
The numbers will change -AND- can either be at the beginning, middle, or end of the %_filename%. In all cases, the pattern will either be S-, PN-, or VF-.
Tried and tried but can't seem to get my $regexp to work.
Help! Please....
No.
You have to look for the underlying pattern.
So in this case a: and c: are the same as they have a single word in front, followed by blank and then a third part which should be extracted. The keyword here is the similar separator
Thy could be treated by a gues values action and the value string %dummy% %subtitle%
Example b: has " - " as separator. so it has be treated differently
%dummy% - %subtitle%
Alternatively, you could first smply copy all data into to field subtitle and then strip the leading information with a "Replace with regular expression" action.
use this search string:
^.* (\w+-\d+)
Replace string:
$1
Thank you so much for replying!
AND, the reg. expr. you provided worked!!
The only glitch was when the Code had a non-white space after the last digit.
I think I need some sort of OR.
How would I place it after the "\d+" ?
Something like this? \d+(\s|\S)
Again, thank you for replying....
I would use the $trim() function in an action of the type "Format value".