Showing posts with label RegEx. Show all posts
Showing posts with label RegEx. Show all posts

Tuesday, April 17, 2007

regex: match a value between two strings

how to capture a value, by group name, between two known string patterns
regex :

Regex re = new Regex("str1(?.*?)str2",RegexOptions.Singleline);

foreach (Match m in re.Matches(data)) {
Console.WriteLine(m.Groups["val"].Value );
}