Nested Regular Expression Testing

Is it Possible to perform regular expression operations on the "Find" from a previous regular expression search/replace?

I have encountered many circumstance where it a specific string is needed to isolate the proper information. I don't always want to change all of the search string, only part of it.

For Example: When I am searching for "Vol 1" in the album field, I desire to leave the "Vol " portion of the search string along, and only process the number, and then only when the number consists of a single digit. I can't really assume this sequence will occur only at the end of the text in the album field, so using the "Trailing Edge Anchor; $".

This leads to all sorts of possible applications for conditional test of a string based on it's length or the length of a substring.

Does anyone have a solution to this problem?


I'm not really sure, if I understand you, but you can

  • write the result of a previous regular expression to a temporary tag field,
  • process its content in another regular expression,
  • format an existing field using the content of the temporary field and
  • finally delete the temporary field
Best regards,
~ Florian

I'm not sure, if I understood you too, but if you want to find a special string containing a number of substrings in one field and change one of this substrings with a single RegEx operation, you can access each match, marked by two brackets () by $n, where n is a number of match, and change only them.

Your Example (?):
find all "vol. 1"/"vol. 2"... and change the 1, 2, 3... in them , for example to [01], [02] ...
RegEx: (vol. )(\d{1})($|\D+)
Replace with: $1[0$2]$3

Thank you for your suggestion. I will give it a try. But while on the subject of "Finds" in a "Replace With Regular Expression" action, What is the scope of the "Find" result? Example: If I search for a specific portion of a string and that "Find" is contained within $3 (for example), is $3 still usable in the next line of the overall "Named Action", or is it's value good only within the "Action Line" where the search was made?

The "Finds" are available only within one "Action line", but I think various small RegEx actions can allways be replaced with bigger one (do you know an example when it's impossible without previous finds?).
If you want to do else with some parts of search result you can do it in "Replace with", for example replace with "$1$upper($3)$2".