Stuart
Stuart

Reputation: 4288

Regular expression for Visual Studio Power Tools custom tab color to match on tabs that start with I (for Interface)

I'd like to colour code my tabs according to file types.

I'd like Interface files to be white.

My naming convention for interfaces is the usual

IFoo.cs IIgloo.cs

etc

To try and colour code these I'm using this regex

^I([A-Z][a-z0-9]*){1}\.cs$

However that is colour coding

Invoice.cs and IInvoice.cs

Where I would like it to only catch IInvoice.cs

Where have I gone wrong with my regex?

I thought this regex would match:

^I - Starts with I

([A-Z][a-z0-9]*) - Then has an upper case character followed by lowercase characters or numbers

{1}\.cs$ - Ends with .cs

Other regex I've tried:

I[A-Z]+[a-z0-9]+\.cs - Matches both Invoice.cs and IInvoice.cs (?:I[A-Z]+[a-z0-9]+\.cs) - Matches both Invoice.cs and IInvoice.cs

Upvotes: 3

Views: 412

Answers (0)

Related Questions