简体   繁体   中英

Python regex to check if a string contains a method call

I am parsing an xml file in python. I fetch the attribute values of xml nodes for processing.

<set name="flashScope.emailSuggestion" value="userBean.createEmailSuggestion(flowRequestContext)" />

Using ElementTree, I get the attribute of the node

node.attrib['value']

which gives me

userBean.createEmailSuggestion(flowRequestContext)

Now how do I check if this string contains paranthesis () ? (I mean, to know that it is a method call)..Can anyone suggest a regex pattern for this?

一般而言,这应该起作用:

^\w+(\.\w+)+\(.*\)$

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM