in reply to A NOT in regular expressions
No guarentees that it will catch every situation, especially as the acknowledged experts are tripping up, but this is my attempt. It seems to work for most cases I can think of and seems somewhat simpler than some of the others.
$_= '1 <% xxx%%> 2 <%%> 3 <%>%> 4 <% >% %> 5 <%%%% xxx %%%%> 6 '; s[ <% .*? (?> %> ) ][!REPLACED!]xg; print; 1 !REPLACED! 2 !REPLACED! 3 !REPLACED! 4 !REPLACED! 5 !REPLACED! 6
|
|---|