Hi
I'm struggling with preg _match and a regex for it.
I understand the concept of it but to actually make the regex is a whole different story.
I found this regex on the web and it works great but lacks one option.
What i want to do is filter an url from a piece of text and save that url.
I am on the right track but need some help with the regex.
Say i have this piece of text (html)
<a href="http://www.meandmymac.net">meandmymac.net</a>
And pull that through this php:
preg_match('/(http:\/\/|https:\/\/|mailto:)(www.|)[\d\w-]{2,63}\.[A-Z]{2,4}(\.[A-Z]{2,4}|)/i', $string, $match);
I get:
http://www.meandmymac.net
Which is great.
But if the url looks like this:
<a href="http://www.meandmymac.net?item=value">meandmymac.net</a>
I still get:
http://www.meandmymac.net
I want to make it so that the ?item=value bit stays on.
Obviously the regex needs to be changed in some way. But i can't figure it out.
Any one have an idea?
Thanks!