查找跨度内的字符

时间:2019-04-04 10:36:22

标签: regex

我想在&nbsp;标签内的文本中找到所有<span>

我尝试使用此正则表达式(?<=<span).*?(?=<\/span>)来获取所有跨度,但我不能仅获取&nbsp;

我应该如何更改正则表达式?

<html><head></head>
<body>
<p  class="style1771705281"><span  class="style871908217">Hello&nbsp;my&nbsp;friend</span></p>
<p  class="style1750113279">
<span  class="style44553984">Test&nbsp;</span>
<span  class="style555336916">email</span>
<span  class="style640575066">&nbsp;with&nbsp;spaces&nbsp;</span>
<span  class="style136848908">Second</span>
<span  class="style1584856224">&nbsp;line&nbsp;</span>
<span  class="style1964378683">Last</span>
<span  class="style491288753">&nbsp;line</span>
</p>
</body>
</html>

谢谢。

0 个答案:

没有答案