Gets an individual member of the collection. : Regular Expression « Development Class « C# / C Sharp
- C# / C Sharp
- Development Class
- Regular Expression
Gets an individual member of the collection.
using System;
using System.Text.RegularExpressions;
public class Class1
{
public static void Main()
{
string sentence = "This is a test";
string pattern = @"\b[Tt]\w*\b";
MatchCollection matches = Regex.Matches(sentence, pattern);
for (int ctr=0; ctr < matches.Count; ctr++)
{
Console.WriteLine(matches[ctr].Value);
}
}
}
Related examples in the same category