CSharp examples for Language Basics:Regex
match 'e' multiple times in the test string
using System;/* ww w . j a v a 2 s . c om*/ using System.Text.RegularExpressions; class MainClass { static void Main(string[] args) { string testString = "This is a test for regular expressions or regex or regexp"; Console.WriteLine("The test string is\n \"{0}\"", testString); Regex expression = new Regex("e"); // match 'e' multiple times in the test string foreach (var myMatch in expression.Matches(testString)) Console.Write("{0} ", myMatch); } }