正则表达式仅在组内替换

时间:2018-01-22 20:51:04

标签: regex

使用正则表达式我想删除所有< b>和< / b>标签内<头>但不在<部分>

输入:

<head>
    <b>some text</b>
    <b>some more text</b>
</head>
<section>
    <b>some text</b>
    <b>some more text</b>
</section>

期望的输出:

<head>
    some text
    some more text
</head>
<section>
    <b>some text</b>
    <b>some more text</b>
</section>

1 个答案:

答案 0 :(得分:-1)

&LT; / B个(?=(\ W \ n \ r \吨\ S&LT;&GT; /] *&LT; /头&GT))

Js解决方案