Q: re
Andrew Kuchling
akuchlin at mems-exchange.org
Tue Oct 24 16:30:01 EDT 2000
"Hwanjo Yu" <hwanjoyu at uiuc.edu> writes:
> >>> matchstr = re.compile(r".*homepage | .*~.*", re.IGNORECASE)
^ ^
The indicated spaces will be included in the pattern as literals, so
it will try to match "homepage ", which isn't what you want. Use
either ...homepage|.*... or add the re.VERBOSE flag to the
re.compile() call, which will cause those spaces to be ignored. (See
the re module's docs for a complete explanation of what re.VERBOSE
does.)
--amk
More information about the Python-list
mailing list