Python 2.7 re.IGNORECASE broken in re.sub?

Alex Willmer alex at
Mon Aug 16 15:33:31 CEST 2010

On Aug 16, 1:46 pm, Alex Willmer <a... at> 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.
> "

Hmm, I found a lot of instances that place (?iLmsux) after non-
whitespace characters\.py[w]%3F$+[^[:space:]%22']%2B\(\%3F[iLmsux]%2B\)

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

More information about the Python-list mailing list