>>> from bs4 import BeautifulSoup
>>> import re
>>> s = BeautifulSoup("<div>test1</div><div>test2</div><div>other stuff</div>")
>>> s.find_all('div', text="test1")
[<div>test1</div>]
>>> s.find_all('div', text=re.compile('test'))
[<div>test1</div> <div>test2</div>]