using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"<center>(.|\n)*?<\/center>";
string input = @"</head>
<body style=""background-color:#9b9b9b;"">
**<center>
<table width=""580"" border=""0"" cellspacing=""0"" cellpadding=""0"" align=""center"" class =""responsive-table"" style=""background-color:#3e5b3e;border:solid thin #3e5b3e;"" >
<tbody>
<tr>
<td background=""http://app.randomsite.com/js/ckfinder/userfiles//images/banner.jpg"" style=""padding-top:20px;padding-right:20px;padding-left:20px;"" class=""hideForMobile""><h1 style=""font-family:Arial, Helvetica, sans-serif;font-size:20px;font-weight:bold;text-align:right;color:#eee;vertical-align:bottom;text-decoration:none;margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;"" >some message</h1></td>
</tr>
<tr>
</center>**
<!---Start of Banner Image--->
<td><a href=""{{Custom1}}"" style=""color:inherit;text-decoration:none;"" ><img src=""http://app.clientcommand.com/js/ckfinder/userfiles//images/top-dollar-ford-banner.jpg"" alt="" class=""table.responsiveImage"" style=""display:block;width:100%;border-style:none;"" /></a></td>
<!---End of Banner Image--->
</tr>
<tr>
**<center>
<table width=""580"" border=""0"" cellspacing=""0"" cellpadding=""0"" align=""center"" class =""responsive-table"" style=""background-color:#3e5b3e;border:solid thin #3e5b3e;"" >
<tbody>
<tr>
<td background=""http://app.randomsite.com/js/ckfinder/userfiles//images/banner.jpg"" style=""padding-top:20px;padding-right:20px;padding-left:20px;"" class=""hideForMobile""><h1 style=""font-family:Arial, Helvetica, sans-serif;font-size:20px;font-weight:bold;text-align:right;color:#eee;vertical-align:bottom;text-decoration:none;margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;"" >some message</h1></td>
</tr>
<tr>
</center>**";
foreach (Match m in Regex.Matches(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