Searching on class tags with multiple spaces and wildcards with BeautifulSoup
<p>I am trying to use BeautifulSoup to find all <code>div</code> containers with the class attribute beginning by "foo bar".  I had hoped the following would work:</p>

<pre><code>from bs4 import BeautifulSoup

import re

soup.findAll('div',class_=re.compile('^foo bar'))
</code></pre>

<p>However, it seems that the class definition is separated into a list, like <code>['foo','bar']</code>, such that regular expressions are not able to accomplish my task.  Is there a way I can accomplish this task? (I have reviewed a number of other posts, but have not found a working solution)</p>