Question about raw string and regex

jlowery at blarg.net jlowery at blarg.net
Thu Mar 23 20:11:49 EST 2006


I'm looking through the tools/scripts folder from the python install,
trying to get reacquanted with the language.  Got a question on the
following classfix.py snippet:

# This expression doesn't catch *all* class definition headers,
# but it's pretty darn close.
classexpr = '^\([ \t]*class +[a-zA-Z0-9_]+\) *( *) *\(\(=.*\)?\):'
classprog = regex.compile(classexpr)

Since the classexpr isn't a raw string (not r prefix), doesn't the \t
get converted to a tab character before it gets to the regex compiler?




More information about the Python-list mailing list