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
    }



  • @publicst

    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


Log in to reply