I\'m using BeautifulSoup. I have to find any reference to the tags with id like: post-#. For example:
tags with id like: post-#. For example:
post-#
For example:
This works for me:
from bs4 import BeautifulSoup import re html = '... ...' soupHandler = BeautifulSoup(html) for match in soupHandler.find_all('div', id=re.compile("post-")): print match.get('id') >>> post-45 post-334