On Thu, Jun 14, 2007 at 10:13:32PM -0000, SmileyChris wrote: > > What you want is "[-A-Za-z0-9_]+". > > > > The reason [-\w] doesn't work is because inside character classes > > ([...]), \w no longer means "alphanumeric characters". It's just a > > character escape. > > Alternately, make the string a "raw" one (note the r before the > quote): > r'[-\w]+'
Not sure that's true. Malcolm was indicating that it is a character escape at the reg-exp level, not the Python string-parsing level. Character classes can't be merged in Python reg-exps. \w represents an entire character class, and, consequently, can't be merged with other classes by putting \w inside the new character class. -Forest
signature.asc
Description: Digital signature

