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


Groups > comp.lang.python > #91732

Re: Pyton re module and POSIX equivalence classes

Path csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; 'classes,': 0.05; 'classes.': 0.07; 'subject:module': 0.09; 'python': 0.11; 'exception': 0.13; "'a',": 0.16; '-tkc': 0.16; 'awk': 0.16; 'equivalence': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'posix': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'module,': 0.18; 'tend': 0.18; 'thanks,': 0.19; '>>>': 0.20; 'lawrence': 0.22; 'recognize': 0.22; 'module': 0.23; 'tried': 0.24; 'header:In-Reply-To:1': 0.24; 'tim': 0.24; 'url:bugs': 0.24; 'header:User-Agent:1': 0.26; 'gnu': 0.27; "doesn't": 0.28; 'chase': 0.29; 'perl': 0.29; 'character': 0.29; 'classes': 0.30; "skip:' 10": 0.30; 'supposed': 0.31; 'knows': 0.32; '[1]': 0.32; 'received:84': 0.32; 'url:python': 0.33; 'to:addr:python-list': 0.35; '???': 0.35; 'expected': 0.35; 'but': 0.36; 'url:org': 0.36; 'there': 0.36; '(and': 0.36; 'subject:: ': 0.37; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'mark': 0.40; 'avoid': 0.61; '8bit%:77': 0.84; 'treats': 0.84; 'url:2015': 0.91
X-CM-Score 0.00
X-CNFS-Analysis v=2.1 cv=OoyysHLt c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=QrohdLjRRo4A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=_IEhM8lNAAAA:8 a=8AHkEIZyAAAA:8 a=TF_s0o0iSu0VHhHIHLsA:9 a=QEXdDO2ut3YA:10 a=txu72aP9soMA:10
X-AUTH mrabarnett@:2500
Date Tue, 02 Jun 2015 00:47:11 +0100
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Pyton re module and POSIX equivalence classes
References <20150601152930.77f0a8fb@bigbox.christie.dr> <mkingq$8b0$1@ger.gmane.org>
In-Reply-To <mkingq$8b0$1@ger.gmane.org>
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.26.1433202435.13271.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1433202435 news.xs4all.nl 2901 [2001:888:2000:d::a6]:35106
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:91732

Show key headers only | View raw


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.

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


Thread

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

csiph-web