shemp has asked for the wisdom of the Perl Monks concerning the following question:
If $address = "4 1/2 MILE RD" this evaluates to true, but i dont see why. There is a "1/2", followed by whitespace. Then there is "MILE", which evaluates to false because of the negative lookahead.if ($address =~ /(1\/2)\s*(?!MILE)/i) { ...
Myself and another programmer have absolutely no idea why the first regex doesnt work as planned, so any insight would be greatly appreciated.if ($address =~ /(1\/2)(?!\s*MILE)/i) { ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex negative lookahead behaviour
by broquaint (Abbot) on Jul 18, 2003 at 17:14 UTC | |
|
Re: regex negative lookahead behaviour
by BrowserUk (Patriarch) on Jul 18, 2003 at 17:08 UTC | |
by pijll (Beadle) on Jul 19, 2003 at 11:49 UTC | |
|
Re: regex negative lookahead behaviour
by sauoq (Abbot) on Jul 18, 2003 at 17:15 UTC | |
|
Re: regex negative lookahead behaviour
by flounder99 (Friar) on Jul 18, 2003 at 18:51 UTC | |
by shemp (Deacon) on Jul 18, 2003 at 19:34 UTC | |
|
Re: regex negative lookahead behaviour
by dws (Chancellor) on Jul 18, 2003 at 19:34 UTC | |
by BazB (Priest) on Jul 20, 2003 at 11:19 UTC | |
|
Re: regex negative lookahead behaviour
by jonadab (Parson) on Jul 19, 2003 at 13:46 UTC | |
|
Re: regex negative lookahead behaviour
by princepawn (Parson) on Jul 18, 2003 at 18:10 UTC | |
by sauoq (Abbot) on Jul 18, 2003 at 18:59 UTC |