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


Groups > comp.lang.python > #91729

Re: Pyton re module and POSIX equivalence classes

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Pyton re module and POSIX equivalence classes
Date 2015-06-01 23:48 +0100
References <20150601152930.77f0a8fb@bigbox.christie.dr>
Newsgroups comp.lang.python
Message-ID <mailman.24.1433198954.13271.python-list@python.org> (permalink)

Show all headers | View raw


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 ???

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Pyton re module and POSIX equivalence classes Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-01 23:48 +0100

csiph-web