私はこのようなhtmlである文字列を持っています
<html>
<div>
<p>this is sample content</p>
</div>
<div>
<p>this is another sample</p>
<span class="test">this sample should not caught</span>
<div>
this is another sample
</div>
</div>
</html>
今、私はこの文字列から単語を検索したいのですがsample
、ここでは、内部にある「サンプル」を取得するべきではありません<span>...</span>
正規表現を使用してこれを実行したいのですが、たくさん試しましたが、できません。どんな助けでも素晴らしいです。
前もって感謝します。