I'm trying to remove all whitepace in an HTML-formatted string, except within the actual content.
so I want to get:
to look like
I've been trying something like:
with the idea being to replace all the whitespace immediately preceeding the "<" character. That would be fine for what I'm doing, but no expression using *,+,.,?, etc, is working. The best I'm able to get is removing the first whitespace before an "<" character, but sometimes there's more than one.
Please help, the only Regex expressions I'm coming up with right now are "@$*%!!!"
so I want to get:
Code:
<p> <b>some text</b> </p>
Code:
<p><b>some text</b></p>
Code:
Regex r = new Regex(@"/s<); r.Replace(str, "<");
Please help, the only Regex expressions I'm coming up with right now are "@$*%!!!"
Comment