Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91732 > unrolled thread

Re: Pyton re module and POSIX equivalence classes

Started byMRAB <python@mrabarnett.plus.com>
First post2015-06-02 00:47 +0100
Last post2015-06-02 00:47 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Pyton re module and POSIX equivalence classes MRAB <python@mrabarnett.plus.com> - 2015-06-02 00:47 +0100

#91732 — Re: Pyton re module and POSIX equivalence classes

FromMRAB <python@mrabarnett.plus.com>
Date2015-06-02 00:47 +0100
SubjectRe: Pyton re module and POSIX equivalence classes
Message-ID<mailman.26.1433202435.13271.python-list@python.org>
On 2015-06-01 23:48, Mark Lawrence wrote:
> On 01/06/2015 21:29, Tim Chase wrote:
>> Is Python supposed to support POSIX "equivalence classes"?  I tried
>> the following in Py2 and Py3:
>>
>>    >>> re.sub('[[=a=]]', 'A', 'aáàãâä', re.U)
>>    'aáàãâä'
>>
>> which suggests that it doesn't (I would have expected "AAAAAA" as the
>> result).
>>
>> Is there a way to get this behavior?
>>
>> I found that perl knows about them but treats them as an exception
>> for now[1].  Supposedly GNU awk (and other GNU POSIXish tools)
>> recognize character classes, as does vim.
>>
>> Thanks,
>>
>> -tkc
>>
>> [1]
>> http://perldoc.perl.org/perlrecharclass.html
>>
>
> I wouldn't know directly as I tend to avoid them like the plague, but if
> not are they in the "new" regex module, see
> https://pypi.python.org/pypi/regex/2015.05.28 and/or
> http://bugs.python.org/issue2636 ???
>
The regex module has POSIX character classes [[:alpha:]], but not
POSIX equivalence classes.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web