i got an string that might look like this
\"myFunc(\'element\',\'node\',\'elementVersion\',\'ext\',12,0,0)\"
i\'m currently checking for va
In re.sub, you need to specify a substitution for the whole matching string. That means that you need to repeat the parts that you don't want to replace. This works:
myRe = re.compile(r"(myFunc\(.+?\,.+?\,)(.+?)(\,.+?\,.+?\,.+?\,.+?\))") print myRe.sub(r'\1"noversion"\3', val)