Steve Holden wrote: > AniNair 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... >> > Perhaps you could give a few example of strings that should and > shouldn't match? It isn't clear from your description what pattern you > are trying to find. > > regards > Steve
If it's operations between two numbers try : r'([\d.]+?)\s*([-+/*%&])([\d.]+)' It will give you 3 groups, first number, operation and second number (caveat emptor). -- http://mail.python.org/mailman/listinfo/python-list