SpartaSixZero
SpartaSixZero

Reputation: 2431

Regular expression to find all function calls with parameters in VS2010

Say I have a function called myFunc(). It can take parameters. I want to find all instances of myFunc() which HAS parameters passed in. What regular expression should I use? I'm using Ctrl+Shift+F in VS2010 and have Use Regular Expressions option selected.

So for example, I want to see

myFunc( varA )

myFunc( varB, varC)

and not

myFunc()

Thanks!

Upvotes: 2

Views: 876

Answers (2)

Ricki Runge
Ricki Runge

Reputation: 421

Here you go

myFunc\(\s*\S.*\)

The \s* checks for zero or more spaces before. \S makes sure at least one non-space is found, and .* tales everything that might also be there.

note that the parantheses is also escaped

Upvotes: 0

Smern
Smern

Reputation: 19086

This is very simple but should do what you are looking for:

myFunc\([^)]+\)

basically looking for:
- myFunc\( = myFunc(
- [^)]+ = one or more of something besides )
- \) = followed by a )

visually:
enter image description here

Upvotes: 2

Related Questions