Search code examples
c#asp.netvisual-studio-2012visual-studio-extensions

Regular Expression to match folder name with Productivity Power Tools Color Coding


I would like to configure a RexEx to match any folder (parent or child) of a file path of any open file. So if any folder in the file path contains the name of the open file, the color coding of the tab is set based on the RegEx match.

For example: websiteRoot/Content/MyName1/site.css = green colored tab when file opened

websiteRoot/Content/MyName2/site.css = orange colored tab when file opened

websiste/Shared/MasterPages/MyName1/main.master = green colored tab when file opened

websiste/Shared/MasterPages/MyName2/main.master = orange colored tab when file opened

I have tried: .*MyName1?$ but this is only looking at the file name I believe.

Also tried .*//MyName1//?$ and I thought this next one would do the trick if Regex for this extension directly matches on the open file path: ^.*\\MyName1

More promising regex with no success:

.*websiteRootPath.*MyName1|myname1|myName1

And if Power Productivity Tools works off a relative path for the open file:

.*MyName1|myname1|myName1

Solution

  • You have to check "Use full document path for regular expression matching" under

    Options -> Productivity Power Tools -> Advanced

    After that, you can use the RegEx's like

    .*app\\model\\.*$
    .*app\\view\\.*$
    .*app\\controller\\.*$