Re: regular expressions an text string

2008-04-17 Thread s0suk3
On Apr 17, 2:09 am, ragia <[EMAIL PROTECTED]> wrote: > hi > i have to match text string char by char to a regular expressions tht > just allow digits 0-9 if other thing a ppear it shall be replaced with > space.how can i do that any help? > so far i have the string and can read it using a for loop

Re: regular expressions an text string

2008-04-17 Thread Peter Otten
ragia wrote: > i have to match text string char by char to a regular expressions tht > just allow digits 0-9 if other thing a ppear it shall be replaced with > space.how can i do that any help? >>> import re >>> s = "abc123_45!6$" >>> re.sub(r"\D", " ", s) ' 123 45 6 ' Peter -- http://mail.p