in reply to A NOT in regular expressions

In your case, don't do a "not", just be less greedy:

$foo =~ s/ \<\% # any left doohickey .*? # minimum span of junk \%\> # first right doohickey //xg;

There is a "negative assertion" which really is a NOT, but it's not as useful here as a simple non-greedy match. Read perlre for more information on the .*? non-greedy match, the (?! ) negative lookahead assertion, and the /x modifier for readable patterns.

--
[ e d @ h a l l e y . c c ]