regular expression

Roy Smith roy at
Tue Aug 16 13:50:55 CEST 2011

In article <mailman.41.1313479583.27778.python-list at>,
 Chris Rebert <clp2 at> wrote:

> pat = re.compile("^ *(\\([^)]+\\))", re.MULTILINE)

First rule of regexes in Python is to always use raw strings, to 
eliminate the doubled backslashes:

> pat = re.compile(r"^ *(\([^)]+\))", re.MULTILINE)

Is easier to read.

More information about the Python-list mailing list