\w in regular expression

stewart stewart at midtoad.homelinux.org
Sun Feb 29 05:02:27 CET 2004


Marcello Pietrobon wrote:

> I also noted that the tools\scripts\redemo.py behaves different than the
> Python command line ( it is not the only case )
> because it matches 'This' when I use \w+  and not when I use \W+

This doesn't sound like an error to me. \w+ matches all lowercase and
uppercase letters, and numbers, while \W+ matches everything else. So of
course 'This' will be matched by \w+ and not by \W+.    It sounds like your
impression was that \w+ matched only lowercase letters, which is not the
case.




More information about the Python-list mailing list