regex - Find pattern in regular expression using C# -


i have string this:

string str = "property first {prop1=val1;prop2=val2}this reg table[uvm]dsfhsjhsdj[/uvm]this uvm test{pp1=vv2}"; 

and need [uvm]...[/uvm] string.

i have tried this:

reg = new regex(@"(\[uvm\].*?\[\\uvm\])"); string s = reg.match(str).groups[0].value; 

but not working. not match. should do?

the problem not regular expression, rather string input.

you input contains [/uvm] , not [\uvm] of course won't matched regular expression.

also, suggest move capture catch inside of uvm, moving parenthesis inside regex, this:

\[uvm\](.*?)\[\\uvm\] 

Comments