RegEx

Harvey Thomas hst at empolis.co.uk
Tue May 14 11:19:55 EDT 2002


> I have a quick regular expression question.
> 
> I'm trying to substute all parathesis -- both left and right 
> -- with a 
> space.  I've tried:
> 
>         no_parans = re.compile('(|)', count = 99)

you need to escape the () characters
          no_parans = re.compile('\(|\)', count = 99)
> 
>         scan_line = no_parans.sub(' ', scan_line)
> 
> 
> This doesn't work.  It had the effect of inserting a space 
> before every 
> character, including the paranthesis.
> 
> What is the solution?
> 
> -- 
> -----------------------
> James A Roush
> jar @ mminternet.com
> -----------------------

_____________________________________________________________________
This message has been checked for all known viruses by the MessageLabs Virus Scanning Service.





More information about the Python-list mailing list