using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?s)(\G|<p class=""oyric"">)((?!</p>).)*?\K((?<=>)\h+|\h+(?=<|\h))";
string input = @" <div align=""justify"">
<table width=""552"" border=""0"">
<tr>
<td><h1 class=""article"" itemprop=""name"">Modals</h1></td>
</tr>
<tr>
<td class=""text_dreapta"">On February 25, 2011, in <a href=""modals.html"" title=""View all articles from Modals"" class=""external"" rel=""category tag"">Destiny</a>, by Roland Worrior</td>
</tr>
</table>
<p class=""text_obisnuit2""><em>Should I stay or should I go?</em></p>
<p class=""oyric""> Laurie Strode comes to her final confrontation with Michael Myers, the masked figure who has haunted her since she narrowly escaped. </p>";
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