in reply to Can't figure out how to invert this regex
Literally: an ampersand not followed by (1 or more alphanums followed by a semicolon).s/&(?![A-Za-z0-9]+;)/REPLACED/g;
If that's not the correct definition of an entity, season to taste.
Not sure why you were looking to the left to determine ampersandy-ness. The interesting part is to the right.
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
s/&(?!(?:[A-Za-z0-9]+|#\d+|#x[0-9A-Fa-f]+);)/REPLACED/g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can't figure out how to invert this regex
by Anonymous Monk on Nov 25, 2005 at 15:05 UTC | |
|
Re^2: Can't figure out how to invert this regex
by Anonymous Monk on Nov 25, 2005 at 15:03 UTC |