regex walktrough

Hans Mulder hansmu at xs4all.nl
Sat Dec 8 18:34:53 EST 2012


On 8/12/12 23:57:48, rh wrote:
> Not sure if the \w sequence includes the - or the . or the /
> I think it does not.

You guessed right:

>>> [ c for c in 'x-./y' if re.match(r'\w', c) ]
['x', 'y']
>>>

So x and y match \w and  -, . and / do not.


Hope this helps,

-- HansM




More information about the Python-list mailing list