A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/295880.html below:

regular expression unicode character class trouble

regular expression unicode character class trouble regular expression unicode character class troubleSteven Bethard steven.bethard at gmail.com
Sun Sep 4 15:08:36 EDT 2005
Diez B. Roggisch wrote:
> Hi,
> 
> I need in a unicode-environment the character-class
> 
> set("\w") - set("[0-9]")
> 
> or aplha w/o num. Any ideas how to create that?

I'd use something like r"[^_\d\W]", that is, all things that are neither 
underscores, digits or non-alphas.  In action:

py> re.findall(r'[^_\d\W]+', '42badger100x__xxA1BC')
['badger', 'x', 'xxA', 'BC']

HTH,

STeVe

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4