开发者

how to replace multiple occurrences of `&nbsp; and <br>`

how to replace multiple occurrences of &nbsp; and <br> at start of the string with j开发者_如何转开发avascript regex?


myString = myString.replace(/^(&nbsp;|<br>)+/, '');

... where /.../ denotes a regular expression, ^ denotes start of string, ($nbsp;|<br>) denotes "&nbsp; or <br>", and + denotes "one or more occurrence of the previous expression". And then simply replace that full match with an empty string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜