python extract title tag from url and html using regex

this will extract the title tag as text from the url and the title tag in the following python script


import re
from urllib.request import urlopen
url = ""
page = urlopen(url)
html ="utf-8")
pattern = "<title.*?>.*?</title.*?>"
match_results =, html, re.IGNORECASE)
title =
title = re.sub("<.*?>", "", title) # Remove HTML tags

No Items Found.

Add Comment
Type in a Nick Name here
Page Views

This page has been viewed 130 times.

Search Code
Search Code by entering your search text above.

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.


Random Quote
You drown not by falling in the river, but by staying submerged.