using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?<=Amount:\s?\$)([0-9,]+\.\d{2})|(?<=Date:\s?)(\d{2}/\d{2}/\d{4})|(?<=Invoice:\s?)(\d+)|(?<=Billing Account Name:\s?)([\w\s]+)";
string input = @"Dear Valued AdRoll Customer,
Your payment for invoice #5925702 has been processed. Please see below for additional details.
Learn more about your billing history.
-- Transaction Details --
Amount: $450.42
Date: 10/15/2024
Invoice: 5925702
Billing Account Name: RRL Exhbits
Profile(s):
Reagan Library
If you have any questions, please contact support@adroll.com.
Download Invoice PDF
Log in to AdRoll
---
If you have any questions, don’t hesitate to contact our Support team or chat with us live.";
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