Regex substitution in python

23 views
Skip to first unread message

Massi

unread,
Oct 27, 2014, 6:54:10 AM10/27/14
to re...@googlegroups.com
Hi everyone,

I succesfully wrote a regex in python in order to substitute all the occurences in the form $"somechars" with another string. Here it is:

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

Now, the problem is that I would like to exclude from the substitution all the strings that start with two dollars symbols, i.e. strings in the form $$"this_string_must_be_kept". Can anyone help me to modify my regex in order to achieve this goal?
Thanks in advance!


iiz

unread,
Oct 28, 2014, 3:52:34 AM10/28/14
to re...@googlegroups.com
This should do it:
Sub \$
For
\$[^$]
Reply all
Reply to author
Forward
0 new messages