[Solved] Python: Find a Sentence between some website-tags using regex


If you must do it with regular expressions, try something like this:

a = re.finditer('<a.+?question-hyperlink">(.+?)</a>', html)
for m in a: 
    print m.group(1)

Just for the reference, this code does the same, but in a far more robust way:

doc = BeautifulSoup(html)
for a in doc.findAll('a', 'question-hyperlink'):
    print a.text

solved Python: Find a Sentence between some website-tags using regex