Regular expression, "except end of string", question.
Derek Basch
dbasch at yahoo.com
Wed Jun 16 22:57:23 EDT 2004
In article <caqvac$t1s$1 at panix2.panix.com>, aahz at pythoncraft.com says...
> In article <MPG.1b3a8b592a44366a989682 at news-server.san.rr.com>,
> Derek Basch <dbasch at yahoo.com> wrote:
> >
> >It always comforting to know that a really simple solution exists after
> >you waste a couple of hours messing with Regular Expressions. :)
>
> 'Some people, when confronted with a problem, think "I know, I'll use
> regular expressions." Now they have two problems.' --Jamie Zawinski
>
(?!...)
Matches if ... doesn't match next. This is a negative lookahead
assertion. For example, Isaac (?!Asimov) will match 'Isaac ' only if
it's not followed by 'Asimov'.
That wasn't covered in my trusty (outdated) Python 2.1 Bible. I should
have gone straight to the Library reference. Thanks.
More information about the Python-list
mailing list