in BeautifulSoup how to split the soup by certain words?

  beautifulsoup, python

I’m using bs4 to scrap a document which has a format like this, and only want all the a tag elements above text2. How can I do so?

<a href="link">link</a>

<a href="link"></a>

If I turn soup into string and split, not sure I can turn it back to soup and I need to use the soup.find_all('a') afterwards.

Source: Python Questions