in reply to Regex'ing backreferences
You first try to find 'foo'. OK. Then you check if the substring between 'foo' and the other 'foo' contains 'bar', but with a zero-width assertion. If that does not contain 'bar', then you can save it into $1./foo(?!.*?bar.*?)(.*?)foo/;
I think it is better, unless you show me another "worst case" :-))/foo(?!.*?bar.*?foo)(.*?)foo/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE (tilly) 2: Regex'ing backreferences
by tilly (Archbishop) on Sep 21, 2000 at 14:37 UTC | |
by japhy (Canon) on Sep 21, 2000 at 15:56 UTC | |
by tilly (Archbishop) on Sep 21, 2000 at 16:10 UTC | |
by tilly (Archbishop) on Sep 21, 2000 at 18:23 UTC | |
by japhy (Canon) on Sep 21, 2000 at 18:28 UTC | |
|
RE (tilly) 2 (still wrong): Regex'ing backreferences
by tilly (Archbishop) on Sep 21, 2000 at 18:27 UTC |