Frank Potter wrote:
> r=re.compile(ur"//[^\r\n]+$", re.UNICODE|re.VERBOSE)
> f_new=r.sub(ur"",f)

>From the documentation:

re.MULTILINE
        When specified [...] the pattern character "$" matches at the
        end of the string and at the end of each line (immediately
        preceding each newline). By default [...] "$" matches only at
        the end of the string.

re.DOTALL
        [...] without this flag, "." will match anything except a newline.

So a simple solution to your problem would be:

r = re.compile("//.*")
f_new = r.sub("", f)


Toby
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to