using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^([a-zA-Z0-9]+)\s{1}[a-zA-Z0-9\.\s]+Ksh([0-9,.]+)\sfrom\s([a-zA-Z0-9\.\s]+)\son\s([0-9/]+)\sat\s([0-9:]+)\s[A|P]M\s.*$";
string input = @"PF56S55yy Confirmed.You have received Ksh6,495.00 from Guaranty Trust Bank Limited 910201 on 5/6/21 at 10:07 PM New M-PESA balance is Ksh10,103.45. Separate personal and business funds through dummytext la dummytext on *377#.";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx