in reply to need regex help to strip things like embedded C comments
I want to NOT have a two character patern in the middle part.
(?!re).
is for regexps what
[^a]
is for characters. So
(?(?!re).)*
would restrict the presence of the regexp like
[^a]*
would restrict the presence of characters where .* would otherwise be used.
You can combine this trick with the code in the example for (??{...}) in perlre (which handles nested parens).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: need regex help to strip things like embedded C comments
by Eradicatore (Monk) on Jul 22, 2007 at 14:47 UTC |