What I'm trying to do is get the text and url out of a string like this:
This is a title [http://awebsite.com/a/download.zip]
This is the regex I am using:
/(.*?)[(.*?)]/
I know what the problem is... the first (.*?)
is matching the whole string! But I'm not sure how to only get it to match upto the first [
occurance.
An explanation of what I'm doing wrong and how to fix would be good thank you. I WILL eventually learn regex!
Thanks guys
PS: using php and the preg_match
function.