in reply to How do I write a regex for 'does not contain' a string.
The top one is reasonably fast, the bottom one is slow, but works for all patterns./^(?:[^f]+|f(?!oo))*$/; # Matches strings not containing 'foo'. /^(?:(?!PATTERN).)*$/; # Matches strings not containing PATTERN +.
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How do I write a regex for 'does not contain' a string.
by IraTarball (Monk) on Aug 09, 2002 at 17:03 UTC |