Q: re
Hwanjo Yu
hwanjoyu at uiuc.edu
Tue Oct 24 16:01:48 EDT 2000
Hi,
It seems that '|' is not working for the OR in regular expression. For
instance,
>>> matchstr = re.compile(r".*homepage", re.IGNORECASE)
>>> re.match(matchstr, "http://www.my.com/me/homepage")
In this case, it returns the match object because the "homepage" is matched.
But,
>>> matchstr = re.compile(r".*homepage | .*~.*", re.IGNORECASE)
>>> re.match(matchstr, "http://www.my.com/me/homepage")
In this case, this should return matchobject since it matches the
"homepage", but it doesn't.
What is wrong here ?
Thanks.
More information about the Python-list
mailing list