Regex substitution trouble

massi_srb at msn.com massi_srb at msn.com
Tue Oct 28 08:28:13 EDT 2014


Hi Chris, thanks for the reply. I tried to use look ahead assertions, in particular I modified the regex this way:

newstring = re.sub(ur"""(?u)(\$\"[\s\w(?<=\\)\"]+\")""", subst, oldstring) 

but it does not work. I'm absolutely not a regex guru so I'm surely missing something. The strings I'm dealing with are similar to formulas, let's say something like:

'$["simple_input"]+$["messed_\\"_input"]+10'

Thanks for any help!



More information about the Python-list mailing list