using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?s)(?:\G(?!\A)|<p(?:\s[^>]*)?\sclass=""(?:[^""]*\s)?c01[\s""])(?:(?!<p[\s>]).)*?\K\.(?=.*?</p>)";
string substitution = @"$0 #";
string input = @"<p class=""c01 c02"">lorem ipsum. dolor sit. amet sed.</p>
<p class=""c01 c02 c03 nnn>lorem ipsum. dolor sit. amet sed.</p>
<p class=""c00 c01 c02 c03 nnn>lorem ipsum. dolor sit. amet sed.</p>
<p class=""c00 c01-1 c02 c03 nnn>lorem ipsum. dolor sit. amet sed.</p>";
RegexOptions options = RegexOptions.Multiline;
Regex regex = new Regex(pattern, options);
string result = regex.Replace(input, substitution);
}
}
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