[ python-Bugs-1285809 ] re special sequence '\w'

SourceForge.net noreply at sourceforge.net
Wed Sep 14 21:45:16 CEST 2005


Bugs item #1285809, was opened at 2005-09-09 11:40
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1285809&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: ChristianJ (cybb20)
Assigned to: Nobody/Anonymous (nobody)
Summary: re special sequence '\w' 

Initial Comment:
>>> rexp = re.compile('\w', re.LOCALE)
>>> rexp.findall('_')
['_']
>>> '_'.isalnum()
False

While the Python docs say, that the underscore is 
supported, I strongly ask why this is so? 
The problem is that I want to match a sequence of 
alphanumeric characters but excluding the underscore.
If you defined \w to not support "_" anymore, people 
could easily check for the "_" as well with \w|_ .

My locale is "de_DE" but it does affect other locales as 
well.


----------------------------------------------------------------------

>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-09-14 21:45

Message:
Logged In: YES 
user_id=1188172

\w matches the underscore since \w has been introduced in RE
syntax, and this was not in Python. This alone is sufficient
to justify this behavior.

Anyway, Python's behavior cannot change, too. Many REs would
become erroneous with such a change.

So closing as Won't fix.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1285809&group_id=5470


More information about the Python-bugs-list mailing list