Skip to content

Instantly share code, notes, and snippets.

@scorta
Created November 30, 2016 04:10
Show Gist options
  • Save scorta/58c9728e3f2a104f20c5354b6988a53e to your computer and use it in GitHub Desktop.
Save scorta/58c9728e3f2a104f20c5354b6988a53e to your computer and use it in GitHub Desktop.
Get All Regex Match From Text
public static string GetAllRegexMatchFromText(string regex, string text)
{
Regex linkParser = new Regex(regex, RegexOptions.Compiled | RegexOptions.IgnoreCase);
string result = string.Empty;
foreach (Match m in linkParser.Matches(text))
result += m.ToString() + "|";
result = result.Remove(result.Length - 1, 1);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment