Problem with regex for custom todo item.

I'm using the Remarker extension for Visual Studio 2015, which allows you to create comments like this:

Snippet

//!++ This will be displayed in red and a big font.

I would like to add a new regex pattern to the todo list patterns "//!", so that the above comments appear in the Resharper's Todo List Explorer. However, I'm getting nowhere.

I've tried numerous patterns and I simply cannot get the regex to work. I've used tools such as The Regulator, and .Net Regex tester website, each of which tell me that I've got the regex working, but when I use that regex in Resharper, none of the comments appear in the window.

Here is the regex

(?<=\W|^)//!\s(?<TAG>Important)(\W|$)(.*)

I know it won't work for //!++ because of the plus symbols, but I'm trying to get it to work with a simple example first.

Could someone help me out please, as I'm not very regex savvy.

 

0
2 comments

To match:

//!++ This will be displayed in red and a big font.

you'll need:

(?<=\W|^)//!\+\+\s*(\W|$)(.*)

The word "Important" doesn't appear in the input text, so your "TAG" group won't work.

A couple of useful RegEx links:

0
Avatar
Permanently deleted user

Hi.

Thanks for the suggestion. That pattern did not work for my unfortunately.

I've been dabbling a bit more, and tried:

(?<=\W|^)(?<TAG>//!(\+\+)?\s*)(\W|$)(.*)

Which did match '//!++ test', and '//! test'', according to The Regulator and .NET Regex Tester. But it's not working for R# as it does not pick up that comment.

I'm baffled as to why R# is failing to find these comments.

0

Please sign in to leave a comment.