 |
The superLibFunc call with comments and named groups:
call = re.compile(r"""
superLibFunc # name of function to match
\s* # possible whitespace
\( # parenthesis before argument list
\s* # possible whitespace
(?P<arg1>%s) # first argument plus optional whitespace
, # comma between the arguments
\s* # possible whitespace
(?P<arg2>%s) # second argument plus optional whitespace
\) # closing parenthesis
""" % (arg,arg), re.VERBOSE)
# the substitution command:
filestr = call.sub(r"superLibFunc(\g<arg2>,
\g<arg1>)",filestr)
|