Revision 98 as of 2008-08-08 21:19:30

Clear message

See Also: ["Asking for Help/Why doesn`t this work?"]

Answered (fully or partially)

x = '"a,b", c, d, "e,f,h", "i,j,k"' re.sub('"([^"]*)"', "\g<1>", x) -> 'a,b, c, d, e,f,h, i,j,k' # Ok for me

re.sub('"([^"]*)"', "|\g<1>|", x) -> '|a,b|, c, d, |e,f,h|, |i,j,k|' # To show the separation of the groups, also Ok

re.sub('"([^"]*)"', "\g<1>".replace(",", "|"), x) -> 'a,b, c, d, e,f,h, i,j,k' # The same result! -> 'a|b, c, d, e|f|h, i|j|k' # It doesn't suppose to replace all "," with "|" like here?

TIA


CategoryFaq

Unable to edit the page? See the FrontPage for instructions.