Quantcast
Channel: Zone-Connect Magento Development UK » php
Viewing all articles
Browse latest Browse all 5

Find URLs in Text description With Regex PHP

$
0
0

This little regex script gives you another simple way to fetch for all possible URLs embedded as simple text in a your rather large description text.

It’s flexible and you can add more filters appropriate for your requirement as you wish..

# take it to the test!
$matches = null;
$returnValue = preg_match_all('%(https://|http://|www)[a-zA-Z0-9\/#&-_\.]+%', $desc_variable, $matches);
# see what you got!
var_dump($matches);

Enjoy!

Magento Developers UK


Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images