How to use Regular Expression to extract information from a HTML webpage?
- by user569248
How to use Regular Expression to extract the answer "Here is the answer" from a HTML webpage like this?
<b>Last Question:</b>
<b>Here is the answer</b>
..:: Update ::..
Thanks everybody!
Here is my solution by using BeautifulSoup since I'm using Python framework:
response = opener.open(url)
the_page = response.read()
soup = BeautifulSoup(''.join(the_page))
paraText1 = soup.body.find('div', 'div_id', text = u'Last Question:')
if paraText1:
answer = paraText1.next