regex walktrough

Hans Mulder hansmu at xs4all.nl
Sun Dec 9 00:34:53 CET 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