<p>假设我有以下HTML:</p>
<pre><code><p>
If everybody minded their own business, the world would go around a great deal faster than it does.
</p>
<p>
Who in the world am I? Ah, that's the great puzzle.
</p>
</code></pre>
<p>我想能够找到所有的标签,包含所有的关键字,我正在寻找。E、 g.(例2和例3不起作用):</p>
^{pr2}$
<p>我一直在试图想出一个正则表达式,允许我搜索所有关键字,但似乎ANDing是不可能的(只有ORing)。在</p>
<p>提前谢谢!在</p>
<p>但最有效的方法可能是:</p>
<pre><code>len(set(soup.find_all(text="world")
& set(soup.find_all(text="book")
& set(soup.find_all(text="puzzle")))
</code></pre>