請教該如何用正則把a標簽的 < " >換成@ # $,而不影響a href的鏈接和其他標簽不允許單獨把a標簽提取出來替換<div>
<div class="bt">2222</div>
<ul>
<li>1</li>
<li>2</li>
</ul>
<a href="https://segmentfault.com">ok</a></div>結果: <div>
<div class="bt">2222</div>
<ul>
<li>1</li>
<li>2</li>
</ul>
@a href=# https://segmentfault.com # $ ok @/a$
@a href=# https://segmentfault.com # $ acb @/a$
@a href=# https://segmentfault.com # $ 123 @/a$
</div>
- 1 回答
- 0 關注
- 676 瀏覽
添加回答
舉報
0/150
提交
取消