Is there any plugin to search specific word within the specific method?
-
Hi,
I would like to know if there are way to search for any word within all of the specific overridden methods.
For example, I have countless amount of method override in one file, and I would like to search a method with for loop in it. This file would have many method declared in it but I am only interested in the overridden method that also contains for loop.
Is there any plugin that supports such a search?
Below is example.
If I search for “method” and “for”, search result would return me method 2 and 4 but not 5th one (because it is different method).void method() // method 1
{
int a = 0;
}void method(int a) // method 2
{
for (int i = 0; i < a; i++)
// do something
}void method(double d) // method 3
{
double a = d;
}void method(string s) // method 4
{
for (int i = 0; i < s.Length(); i++)
// do something
}void otherMethod() // method 5
{
for (int i = 0; i < 10; i++)
// do something
} -
with a regex like this
(?is)void method(?>(?!\}).)*for.*?\}it should be possible.Cheers
Claudia -
Wow that certainly does it!
Thank you so much! This saves me a lot! -
Hi, @publicst, @claudia-frank and All,
A similar and more simple regex could be :
SEARCH
(?s-i)void method[^}]+for.+?\}Cheers,
guy038
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login