in reply to Re: RegEx - match !foo followed by foo
in thread RegEx - match !foo followed by foo
Thanks Corion, but I don't think either merlyn's or your solution works... also I made one mistake in my examples:
foobar:helloworldgonk shouldn't match, because neither gonk nor @ can be found after no more than 5 preceding characters
Merlyn's solution fails (afaik) because it doesn't require the non-gonk to be followed by gonk (or @).
Your solution fails (afaik) because foobar:gonkgonk would return 'foobar:gonk' (and should return nothing).
To put it another way, if 'gonk' was a single character (say '£'), then I would do:
/foobar:[^£@]{1,5}[£@]/
Hope that makes it clearer
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: RegEx - match !foo followed by foo
by Corion (Patriarch) on Mar 16, 2006 at 13:36 UTC | |
by Melly (Chaplain) on Mar 16, 2006 at 13:45 UTC | |
by Corion (Patriarch) on Mar 16, 2006 at 13:49 UTC | |
by Melly (Chaplain) on Mar 16, 2006 at 13:57 UTC |