下午好
我正在 regex101.com 网站上测试我的正则表达式。 正则表达式:
<button[^<]*>.*[\s\S]*<\/button>|
<iframe[^<>]*\/>|
<tr>[^<td>]*<\/tr>
测试文本
<table width="30px">
<P>Teste</p><iframe src="teste" /><p>Test</p>
<div><span>Teste Regex</span></div>
<p>Test</p><button onclick="myFunction()">Click me</button>
<table>
<tr><td>34</td></tr>>
</table>
为什么只有 <button[^<]*>.*[\s\S]*<\/button>
代码匹配吗?
如果我清除正则表达式的这一部分并仅保留此部分:
<iframe[^<>]*\/>|
<tr>[^<td>]*<\/tr>
仅<iframe..
已匹配
为什么会发生这种情况以及如何解决它?
最佳答案
关于javascript - 正则表达式替换不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27044023/