问题
I want to remove starting and trailing br and nbsp tags from a string using java or javascript.
Input and desired output are hosted in jsfiddle.net because Stackoverflow is not letting me to post html content.
http://jsfiddle.net/HwDf9/
回答1:
Something like this?
request.replace(/^\ \;|<br?\>*/gi, "").replace(/\ \;|<br?\>$/gi, "").trim();
来源:https://stackoverflow.com/questions/7360447/trim-nbsp-and-br-tags-from-string-java-or-javascript