HREF URL Extractor
Working with regular expressions
To extract the value (URL) of an HREF attribute from a string, use the preg_match or preg_match_all function. This example use preg_match_all to find all the matches.
preg_match_all - Perform a global regular expression match
preg_match_all (pattern (string), target (string), matches (array), optional flags)
Searches target for all matches to the regular expression given in pattern and puts them in matches in the order specified by the flags.
The regular expression: <\s*a\s+[^>]*href\s*=\s*[\"']?([^\"' >]+)[\"' >]