This is an old copy of the Python FAQ. The information here may be outdated.

Why doesn't my regular expression work?

Typically, it’s an issue between re.match and re.search. Match matches the beginning only and search checks the entire string. See the regular expression HOWTO for more details:

http://www.amk.ca/python/howto/regex (dead link)

Also, Python comes with a handy program for testing regular expressions, in Tools/scripts/redemo.py.

CATEGORY: tutor

 

A Django site. rendered by a django application. hosted by webfaction.