using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"\bDELIVER TO:\R\h*(\S+).*(?:\R.*){2}.*\h(\S+)";
string input = @"RECOVER FROM:
LUFTHANSA CARGO - FRA
FLIGHT: LH441
ETA: SUN 25-APR-2021 09:09
WAYBILL: 020-90350573
ORIGIN: IAH
SERVICE: ZXO Courier Solution
x0Wx0H in. 109 lbs (49.0 kg) Skid
DELIVER TO:
VITESCO TECHNOLOGIES CZECH REPUBLIC S.R.O
VOLANOVSKA 518
TRUTNOV 541 01 CZ
ATTN: ADAM STUCHLIK
PHONE: +420 731 593 139
EST. DISTANCE: 293 miles
PCS/WT: 1 / 49.0 kg (109 lbs)
DIMS: 1@82x82x51cm
ORDER#: 10659800
CONTENTS: PCV PANNEL
SERVICE: Next Flight Out(NFO)
URGENT! PLEASE CONFIRM THIS ALERT BY EMAILING CnwGermanyOps@cnwglobal.com OR CALLING COURIER NETWORK INC. AT 800-852-2282";
Match m = Regex.Match(input, pattern);
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