I am searching through an OPML file that looks something like this. I want to pull out the outline text and the xmlUrl.
<outline text="lol">
<outline text="Discourse on the Otter" xmlUrl="http://discourseontheotter.tumblr.com/rss" htmlUrl="http://discourseontheotter.tumblr.com/"/>
<outline text="fedoras of okc" xmlUrl="http://fedorasofokc.tumblr.com/rss" htmlUrl="http://fedorasofokc.tumblr.com/"/>
</outline>
My function:
import re
rssName = 'outline text="(.*?)"'
rssUrl = 'xmlUrl="(.*?)"'
def rssSearch():
doc = open('ttrss.txt')
for line in doc:
if "xmlUrl" in line:
mName = re.search(rssName, line)
mUrl = re.search(rssUrl, line)
if mName is not None:
print mName.group()
print mUrl.group()
However, the return values come out as:
outline text="fedoras of okc"
xmlUrl="http://fedorasofokc.tumblr.com/rss"
What is the proper regex expression for rssName and rssUrl so that I return only the string between the quotes?