good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Regex gurus: How do I NOT match something inside something else? E.g. I want to match X but not if its in braces {X}? Example: I want to replace all newlines (\n) with (\n<br>), but not if they are inside double-braces. For example:
In $data, above, the lines with 'foo' and 'bar' should have the <br> added, but the lines with 'alpha' and 'beta' should not be touched. Am I just missing something simple in perlre that would make this work? I don't even know where to start - other than some non-regex solution entirely. In reply to Replace newlines only if not inside braces by jbryan
|
|