Regex to get method parameter name

安稳与你 提交于 2019-12-11 15:20:16

问题


Need regular expression to replace only parameter name. By program i am able to fetch the parameter name but while replacing it using regular exression , its failing when we have both parameter class and parameter name as same. like below method:
getCustomerCyclesListInfo( CustomerCyclesListInfo CustomerCyclesListInfo, CustomerCyclesListInfo CustomerCyclesListInfo)

i tried with below regex but its matching all four in above : (?<!\()\b(CustomerCyclesListInfo)\b

i want that word starting with ( (opening parenthesis) space or ,(coma) space should not be considered while capturing.


回答1:


Try this:

\bCustomerCyclesListInfo(?= *[,)])

See live demo.



来源:https://stackoverflow.com/questions/51752670/regex-to-get-method-parameter-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!