Friday, September 26, 2014

perl multiple "or" statements

Apparently in perl, multiple "or" are synced if the result is used in a replacement. E.g.:

s/(a|b)some_text(x|y)/\1new_text\2/g

will only find and replace

a(some_text)x
b(some_text)y

and no permutations of these !

No comments:

Post a Comment