XP is just a number | |
PerlMonks |
(elbie): regex for but not \\by elbie (Curate) |
on May 27, 2002 at 01:00 UTC ( [id://169456]=note: print w/replies, xml ) | Need Help?? |
Look ahead and look behind assertions are perfect for this sort of thing. In this case, negative assertions can make sure that the extra pattern you specify (i.e. the backslash) doesn't occur: m/(?<!\\)\[.*?\](?!\\)/g should do what you want. Update: jeffa pointed out my .?* should in fact be a .*? elbieelbieelbie
In Section
Seekers of Perl Wisdom
|
|