Tuesday, February 7, 2012

Python regex replace part of matched string


myRe = re.compile(r"(myFunc\(.+?\,.+?\,)(.+?)(\,.+?\,.+?\,.+?\,.+?\))")
print myRe.sub(r'\1"noversion"\3', val)

No comments:

Post a Comment