开发者

RegEx Quickie Special Selection

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'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜