CSharp examples for Language Basics:Regex
match 'e' in the test string
using System;// w ww . j a va 2 s. c o m 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 ); Console.Write( "Match 'e' in the test string: " ); // match 'e' in the test string Regex expression = new Regex( "e" ); Console.WriteLine( expression.Match( testString ) ); Console.Write( "Match every 'e' in the test string: " ); } }