I can't figure out where I'm wrong.
I have a pile of pages from where I need to get the content of the tags and make it a file name.
My regex
title2 = re.search(r'(<title>)(.+)(</title>)', content)
filename_test = str(title2.group(2)+'.txt')
It works fine until it comes to a title like this:
<title>Klaatu - barada nikto
</title>
I've tried a lot of variants, none of them works.
Main idea is that something like this should have worked:
title2 = re.search(r'(<title>)(.+)(\n|(</title>))', content)
i.e. "stop when you come to new line or this tag" But it doesn't.