Beautiful Soup Using Regex to Find Tags?

Note that you can also use regular expressions to search in attributes of tags. For example:

import re
from bs4 import BeautifulSoup

soup.find_all('a', {'href': re.compile(r'crummy\.com/')})

This example finds all <a> tags that link to a website containing the substring 'crummy.com'.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)