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


Groups > comp.lang.python > #87217

Re: Letter class in re

Date 2015-03-09 16:39 +0100
From Antoon Pardon <antoon.pardon@rece.vub.ac.be>
Subject Re: Letter class in re
References <1425908003.40588.YahooMailBasic@web163805.mail.gq1.yahoo.com>
Newsgroups comp.lang.python
Message-ID <mailman.222.1425915597.21433.python-list@python.org> (permalink)

Show all headers | View raw


Op 09-03-15 om 14:33 schreef Albert-Jan Roskam:
> I was going to make the same remark, but with a slightly different solution: 
> In [1]: repr(re.search("[a-zA-Z]", "é"))
> Out[1]: 'None'
>  
> In [2]: repr(re.search(u"[^\d\W_]+", u"é", re.I | re.U))
> Out[2]: '<_sre.SRE_Match object at 0x027CDB10>'
>
> "[^\d\W_]+" means something like "one or more (+) of 'not (a digit, a non-word, an underscore)'.
>
Nice, I am seriously considering this, if only because I have less trouble
understanding this. I'll run some tests to see what gives.

-- 
Antoon Pardon

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


Thread

Re: Letter class in re Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-03-09 16:39 +0100

csiph-web