Tag Archives: matches

Show regular expression matches in C#

When you click the Go button, the program uses the following code to display regular expression matches in a string. Regex reg_exp = new Regex(txtPattern.Text); MatchCollection matches = reg_exp.Matches(txtTestString.Text); rchResults.Text = txtTestString.Text; foreach (Match a_match in matches) { rchResults.Select(a_match.Index, a_match.Length); … Continue reading

Posted in regular expressions, strings | Tagged , , , , , , , , , , | Leave a comment