You can use python re module's compile/match, and by doing so, you can remove bunch of parenthesis
p = re.compile(r"""
rename_method\( #
\"([^\"]*)\", # %.Arith#add()
\"([^\"]*)\", # %.Arith#addRefactored()
\"([^\"]*)\" # %.Arith
\)
"""
, re.VERBOSE)
m = p.match(inputstring)
if m:
beforeMethodName = m.group(1)
afterMethodName = m.group(2)
For concatenating strings in python with some comment, you can check this post. For re.VERBOSE, check this site. For regular expression in python, check this site, and this one.
No comments:
Post a Comment