Regular expression to get text inside brackets
I will admit that I am hopelessly writing regular expressions. So who can offer help 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 would like something in between the parentheses to be matched. Thanks for your help.
+2
Kane
source
to share
3 answers
Regex r = new Regex(@"^value\((.*)\)\.$");
+2
Matthew scharley
source
to share
I would suggest investing in a tool like RegexBuddy. Give it a free trial.
+1
Tim tonnesen
source
to share
Assuming there are no parentheses in the substring:
Regex re = new Regex(@"^value\([^\)]+\)\.$");
0
Rodrigo
source
to share