Alright, I'm no pro at RegExpression so can someone give me the reg expression that would select the display()
and first_name
i开发者_开发百科n the following haystack string?:
$Question -> display();
$Person -> first_name;
Use ->\s+(.*);$
>>> re.search(r'->\s+(.*);$', '$Question -> display();').group(1)
'display()'
>>> re.search(r'->\s+(.*);$', '$Person -> first_name;').group(1)
'first_name'
精彩评论