Python 2.7 re.IGNORECASE broken in re.sub?

Alex Willmer alex at moreati.org.uk
Mon Aug 16 15:33:31 CEST 2010


On Aug 16, 1:46 pm, Alex Willmer <a... at moreati.org.uk> wrote:
> "Note that the (?x) flag changes how the expression is parsed. It
> should be used first in the expression string, or after one or more
> whitespace characters. If there are non-whitespace characters before
> the flag, the results are undefined.
> "http://docs.python.org/library/re.html#regular-expression-syntax

Hmm, I found a lot of instances that place (?iLmsux) after non-
whitespace characters

http://google.com/codesearch?hl=en&lr=&q=file:\.py[w]%3F$+[^[:space:]%22']%2B\(\%3F[iLmsux]%2B\)

including two from the Python unit tests, re_test.py lines 109-110.
Perhaps the documentation is overly cautious..



More information about the Python-list mailing list