// http://stackoverflow.com/q/33592525/5290909 using System; using System.Text.RegularExpressions; public class Test { public static void Main() { string pattern = @"[^>]*<\/script>"; var re = new Regex( pattern); var text = @" "; MatchCollection matches = re.Matches(text); for (int mnum = 0; mnum < matches.Count; mnum++) { //loop matches Match match = matches[mnum]; Console.WriteLine("Match #{0} - Value: {1}", mnum + 1, match.Value); } } }