Jonathan Gardner at
Tue Sep 4 21:47:11 CEST 2007

On Sep 4, 6:32 am, AniNair <anitn... at> wrote:
> hi.. I am trying to match '+ %&/-' etc using regular expression  in
> expressions like 879+34343. I tried \W+   but it matches only in the
> beginning of the string Plz help Thanking you in advance...

You may want to read the page describing the regex syntax a little

\W would match anything but \w. That is, it would match spaces and
tabs as well as the weird characters. I don't think that's what you

Also, don't forget to use raw strings. r"\W+" is preferred over "\W+".

More information about the Python-list mailing list