I am using BeautifulSoup to look for user entered strings on a specific page. For example, I want to see if the string \'Python\' is located on the page: http://python.org<
In addition to the accepted answer. You can use a lambda instead of regex:
lambda
regex
from bs4 import BeautifulSoup html = """test python""" soup = BeautifulSoup(html, "html.parser") print(soup(text="python")) print(soup(text=lambda t: "python" in t))
test python
Output:
[] ['test python']