regex and IGNORECASE

John Machin sjmachin at lexicon.net
Mon Nov 26 06:09:10 EST 2007


On Nov 26, 9:53 pm, Yann Le Boulanger <aste... at lagaule.org> wrote:
> Hi all,
>
> I have a problem with regex , utf-8 chars and IGNORECASE
>
>  >>> re.search(u'é', u'qwért', re.IGNORECASE)
> <_sre.SRE_Match object at 0x2aaaaed0c100>
>
> Here everything is ok.
>
>  >>> re.search(u'É', u'qwért', re.IGNORECASE)
>
> Here that doesn't work. but:
>  >>> print u'é'.upper()
> É
>
> is it a bug in IGNORECASE option?
>

... or poor documentation of a not-very-intuitive API?

>>> re.search(u'\xc9', u'qw\xe9rt', re.IGNORECASE)
>>> re.search(u'\xc9', u'qw\xe9rt', re.IGNORECASE + re.UNICODE)
<_sre.SRE_Match object at 0x00DC14F0>
>>>



More information about the Python-list mailing list