cleanup using custom pattern

Hi all,

I'd like to remove all my company renamed "endregions". So
#region A
// lines of code
#endregion A

will became in:
#region A
// lines of code

My idea is to use a custom pattern to find and replace these cases.
But I can't achieve it, I've two problmes:

Problem1: How can I "link" a custom pattern to be found and replaced when doing a code clean up?

Problem2: I've already tried to do the custom pattern and I can't get it.
Knowing that the following regex works correctly to found the pattern: ^(\s)*\#endregion(.+)$
I tried with two identifier placeholders, one for previous possible tabs and spaces and another finding the name I want to remove
where $tabs$ is an identifier placeholder with regex: ^(\s)*
and $regionName$ is an identifier placeholder with regex: (.+)$
Unfortunatelly I can't check if it works because Resharper advise me that $regionName$ is an unexpected placeholder.

Can any one tell me if:
Problem 1 is possible to solve?
Problem 2, where am I wrong?

Comment actions Permalink

ReSharper's Search with Pattern functionality doesn't support region directives. Sorry for that.

Comment actions Permalink

What a pity!

Thanks anyway Victor, so now I don't need to continue squeezing my brian ;)

Won't be interesting to add a feature similar to what I asked to? So one can find patterns known and then clean up them as desired?

Thanks again!

Comment actions Permalink

Search with Pattern is designed to work with pure code tree ignoring all whitespace, comments, etc. So we don't have any plans to support matching #region directives. Sorry for that.


Please sign in to leave a comment.