tags:

views:

99

answers:

3

I going to admit that I am hopeless at writing regular expressions. So can anyone please offer assistance in writing an expression (in C#) that will match the following cases:

value(Plugin.Tests.Business.Services.Repositories.Maps.SomeTests+<>c__DisplayClass2).
value(Plugin.Tests.Business.Interfaces.SomeOtherClass+<>c__DisplayClass3).

Ideally I'd like anything between the brackets to be matched. Thanks for your assistance.

+1  A: 
Regex r = new Regex(@"^value\((.*)\)\.$");
Matthew Scharley
A: 

Assuming you don't have any parentheses inside the substring:

Regex re = new Regex(@"^value\([^\)]+\)\.$");
Rodrigo
Simply using `.*` is a better solution, unless you plan to be using something like the `Multiline` or `SingleLine` regex options
Matthew Scharley
+1  A: 

I would suggest investing in a tool like RegexBuddy. Give it a free trial.

Tim Tonnesen