I have html code which jQuery adds random attributes to it like:
<td style='font-size: x-large;' jquery9202340423042='22423423424'>
Using c# Regex I want to find and remove any attribute which starts with jquery
I have the code below but it removes all attributes:
public static void Main(string[] args)
{
string before ="<td style='font-size: x-large;' jquery9202340423042='22423423424'>";
//string after = Regex.Replace(before, regexImgSrc, "<$1>");
//string regexImgSrc = @"<(table|tr|td)[^>]*?" + "jquery9202340423042" + @"\s*=\s*[""']?([^'"" >]+?)[ '""][^>]*?>";
string after = Regex.Replace(before, @"(?i)<(table|tr|td)(?:\s+(?:""[^""]*""|'[^']*'|[^""'>])*)?>", "<$1>");
Console.WriteLine(after);
}