我有字符串test1 test2 tes<span style="color:red;">t3</span> span test4
,我想将span标签放在</span>
之后的span
单词周围,而又不触及现有的span标签使用javascript正则表达式。
REgex:
(<\/span> )(span)
REplacement string:
$1<span>$2</span>
> 'test1 test2 tes<span style="color:red;">t3</span> span test4'.replace(/(<\/span> )(span)/g, "$1<span>$2</span>")
'test1 test2 tes<span style="color:red;">t3</span> <span>span</span> test4'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.