I'm making a C# regex to find and replace patterns related to html content. i need to get all the stuff like that:
<table border=0 align=center id=mytable5>
corrected like that:
<table border="0" align="center" id="mytable5">
i tried out this:
String pattern = @"\s(?<element>[a-z])=(?<valeur>\d+?[a-z])\s?[\>]";
String replacePattern = "${element}=[\"]${valeur}[\"]";
html = Regex.Replace(html, pattern, replacePattern, RegexOptions.IgnoreCase);
but there is absolutly no effect. Any help would be greatly appreciated. thank you all
Actually King King, there is a problem with your regex
<table border=0 align="center" id="mytable5">
will give
<table border="0" align=""center"" id=""mytable5"">
thats why the regex must check this
[a space][a-z]=[a-z0-9][a space or '>']