regex ?

Alex Martelli aleax at
Fri Jan 11 09:47:30 EST 2002

"Chris Dutton" <cmbchris at> wrote in message
news:B8635129.1A6C%cmbchris at
> in article 3c34bcc9$0$79560$6e49188b at, Greg Krohn at
> infinitystwin.SPAM at wrote on 1/3/02 3:23 PM:
> > pat = re.compile(r"<title>(.*)</title>", re.I)
> Or just in case somebody puts two set of titles in one document, for
> whatever reason...
> pat = re.compile(r"<title>([^</title>]+)</title>", re.I)

No!!!  The part [^</title>] excludes any of the CHARACTERS lessthan,
slash, t, i, l, e, and greaterthan, from being accepted as part of
a title.  This is VERY unlikely indeed to be what one would want.


More information about the Python-list mailing list