using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^(?=.*\bsubject\b)(?=.([\s\S]*)urgent)(?=.([\s\S]*)yahoo\.com).*$";
string input = @"User-Agent: Microsoft-MacOutlook/10.17.1.190326
Date: Wed, 05 Jun 2019 15:04:21 +0800
Subject: FW: DR OKE DANLDAI PLEASEURGENT
From: Dennis Chng <Dennischng@r-logic.com>
To: helpdesk <helpdesk@iqon-asia.com>,
Raynor Tan <raynor@iqon-asia.com>
Message-ID: <IQON.6059aba563.EF09158E-9BED-4A49-AE31-6851E971014F@r-logic.com>
Thread-Topic: DR OKE DANLDAI PLEASE URGENT
References: <341174902.187389.1559716703368.ref@mail.yahoo.com>
<341174902.187389.1559716703368@mail.yahoo.com>
In-Reply-To: <341174902.187389.1559716703368@mail.yahoo.com>
Mime-version: 1.0";
RegexOptions options = RegexOptions.IgnoreCase | 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