I’m using string.match to extract the image URL from an RSS feed into my app. But I’m just not knowledgeable enough about regular expressions to do it properly.
My feed is stored in a table called stories[1].content_encoded (thank you, Rob Miracle for the super RSS reader code). So the string looks kinda like this:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. <img src=“http://www.myDomain/wp-content/2013/08/myImage.jpg” alt=“my image” />Nunc commodo, metus ornare convallis blandit, arcu tortor hendrerit sapien, vel porttitor tortor magna non urna. Mauris ut tincidunt massa. Sed bibendum pharetra aliquam.
I got as far as this:
local imgURL = string.match(stories[1].content_encoded, (" src=.* " ))
but obviously it matches the whole line, including my alt tag.
I just want to pull the URL without the quotes so I can set the URL to a local variable that is called in display.loadRemoteImage. I’m sure it can be done in RegEx I just don’t know how.