Sandeep Chauhan
Sandeep Chauhan

Reputation: 171

Regex to get method parameter name

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.

Upvotes: 0

Views: 260

Answers (1)

Bohemian
Bohemian

Reputation: 425003

Try this:

\bCustomerCyclesListInfo(?= *[,)])

See live demo.

Upvotes: 1

Related Questions