所以我试图创建一个正则表达式来匹配不同类型的 html 标记中的文本。在这两种情况下,它都应该匹配粗体文本:
<div class="username_container">
<div class="popupmenu memberaction">
<a rel="nofollow" class="username offline " href="http://URL/surfergal.html" title="Surfergal is offline"><strong><!-- google_ad_section_start(weight=ignore) -->**Surfergal**<!-- google_ad_section_end --></strong></a>
</div>
<div class="username_container">
<span class="username guest"><b><a>**Advertisement**</a></b></span>
</div>
我尝试使用以下正则表达式没有任何结果:
/<div class="username_container">.*?((?<=^|>)[^><]+?(?=<|$)).*?<\/div>/is
这是我第一次在 stackoverflow 上发帖,所以如果我做了一些非常愚蠢的事情,我只能道歉。