[英]Javascript Regex replace (remove) <br> tag at the start of the string
how can i only remove <br>
at the start of the string? 我如何只删除字符串开头的
<br>
?
from: 从:
'<br><br><br>My Text<br>is here<br>'
to: 至:
'My Text<br>is here<br>'
You can use replace()
with regex /^(<br\\s*\\/?>)+/
您可以将
replace()
与正则表达式/^(<br\\s*\\/?>)+/
var str='<br><br><br>My Text<br>is here<br>'; alert(str.replace(/^(<br\\s*\\/?>)+/,''))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.