you'd probably want to use preg_match_all, assuming you want to find every URL in a given string. if you only care about the first URL in the string, you could use preg_match. there are lots of good examples on all the [man]PCRE[/man] function pages in the manual.