Mega Code Archive

 
Categories / C# / Development Class
 

Position and index

using System; using System.Text.RegularExpressions; class MatchingApp {     static void Main(string[] args) {         Regex r = new Regex("in");         Match m = r.Match("Matching");         if (m.Success) {             Console.WriteLine("Found '{0}' at position {1}",m.Value, m.Index);         }     } }