lundi 18 juillet 2016

Python Regex in BS4 Soup Not Matching

I am trying a match a regular expression that works correctly in RegExr, but isn't working in my Python script.

ind = soup(text=re.compile('(Industry)(.*)(</a>)')) should return:

Industry: <a href="?catid=us-TRBC:5410103010&amp;ei=-uNqV8uXGquUigLKj6qQCQ">Non-Alcoholic Beverages - NEC</a>

but it ends up returning an empty list. Is there something wrong with my Python syntax? (I'm trying to match a string that starts with 'Industry' and ends with </a>)

Aucun commentaire:

Enregistrer un commentaire