Stavros Koureas Stavros Koureas - 1 year ago 86
C# Question

Match with reges excluding string tags

I am trying to write a code in order to get the matches in a list but without the match tags, until now i have built the following code in WP7 application written on C#

public static MatchCollection MatchTags(string content, string string_start, string string_end)
MatchCollection matches = Regex.Matches(content, string_start + "(.*?)" + string_end, RegexOptions.IgnoreCase);
return matches;

So how to return matches without string_start, string_end (match tags) without use of replace function after the match extraction?

Answer Source

It works when i get the result with the next code:

string my_string_no_tags = matches[number].Groups[1].Value;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download