Custom Web Applications to Grow Your Business

(256) 429-8145

How to extract of scrap url from string using regex preg_match

Yellow canary on its perchAre you working on a url scraping project? Here is a quick way to extract urls from string using preg_match in php. Very simple. You can incorporate it into a function, etc if(preg_match("/[a-z]+:\/\/\S+/",$article,$matches)){ foreach($matches as $url){ echo $url; Once you have the $url variable you can create a MYSQL SELECT statement to inject into your tables