c# - using Regex Constant to return string between two tags -


i'm trying use in c#

 var added = regex.match(text,  "\[begintag\](.+?)\[\/endtag\]",regexoptions.none); 

to return string between tags [begintag] , [/endtag] in text string. can't figure out what's wrong regex constant.

your regex good. need extract group 1 (the thing match between parenthesis)

in c# becomes

regex regexobj = new regex(@"\[begintag\](.+?)\[/endtag\]"); resultstring = regexobj.match(subjectstring).groups[1].value; 

let me know if works

also, fyi, don't need escape as do. good:

\[begintag](.+?)\[/endtag] 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -