Hello monks,
I am doing some substitutions of strings with a regex. For example, I have code like this:
But now the problem is that some of the words have embedded XML tags. I would like to still perform the substition but keep the XML tag. There is at most one XML tag in a word; for example: <tag>f</tag>oo should become <tag>b</tag>ar%dictionary = (foo => 'bar', baz => 'w00t'); $str =~ s[$_][$dictionary{$_}] for keys %dictionary;
and
<b>fo</b>o should become <b>ba</b>rIs there a simple way of doing this without writing out all of the possible combinations? Thanks!
In reply to Keeping tags in regex by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |