using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"<li id=""hit-[0-9]+"">(.*?)<\/li>";
string input = @"<li id=""hit-11"">
<h2>
<a href=""http://www.sonymobile.com/gb/products/phones/xperia-z2/"" class=""heading"">Xperiaâ„¢ <b>Z2</b> | Android Phone - Sony Smartphones (UK)</a>
</h2>
<p><b>...</b> Xperiaâ„¢ <b>Z2</b>. The world&#39;s best camera and camcorder in a waterproof<br> smartphone*. <b>...</b> The Xperia <b>Z2</b> makes the moment unforgettable. Meet Xperia <b>...</b> </p>
<p>
<a href=""http://www.sonymobile.com/gb/products/phones/xperia-z2/"" class=""link"">http://www.sonymobile.com/gb/products/phones/xperia-z2/</a>
</p>
</li>
<li id=""hit-2"">
<h2>
<a href=""http://www.sonymobile.com/gb/products/phones/xperia-z2/accessories/""
class=""heading"">Xperia <b>Z2</b> Accessories | Smartphone accessory - Sony <b>...</b></a>
</h2>
<p><b>...</b> Xperiaâ„¢ <b>Z2</b>. The world&#39;s best camera and camcorder in a waterproof<br> smartphone*. <b>...</b> Then watch your life played back to you on your Xperia <b>Z2</b>. <b>...</b> </p>
<p>
<a href=""http://www.sonymobile.com/gb/products/phones/xperia-z2/accessories/""
class=""link"">http://www.sonymobile.com/gb/products/phones/xperia-z2/accessories/</a>
</p>
</li>";
RegexOptions options = RegexOptions.IgnoreCase | RegexOptions.Singleline;
Match m = Regex.Match(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