Is there an easy way to change a string like "DIV class=demo id=3"
to: "DIV class='demo' id='3'"
?
I am planning to write a recursive function. Is there any easy way to do this?
Is there an easy way to change a string like "DIV class=demo id=3"
to: "DIV class='demo' id='3'"
?
I am planning to write a recursive function. Is there any easy way to do this?
result = Regex.Replace(input, @"(\b\w*=)(\w*\b)", @"$1'$2'");
This replaces any alphanumericword=alphanumericword
with alphanumericword='alphanumericword'
But this might not be exactly what you want.
find this
/(<[^>]+?=)([^"'\s][^\s>]+)/gi
replace with this
$1'$2'
note this has worked for years for me until youtube started putting white space in their links!! Bad youtube!!
Since title has nothing to do with question I'd advice unrelated thing too :)
Do not use IE7 mode for your web page and you will get innerHTML formatted properly the way you expect.