I need to find a url in text starts with domain zippyshare and put it in the var. I know that i must use regular expression but i don't have idea to make it. Lets say that we have 3 links in text
Facebook: https://facebook.com/pumpsquadofficial Instagram: https://instagram.com/pump_squadpl DOWNLOAD MP3: http://www42.zippyshare.com/v/d6LnGjH8/file.html
and i need to find and put this link "www.42.zippyshare.com/v/blahblahblah" into <a href="$link">. Do you have any idea how to make it? Sorry for my english.
Your question is pretty vague... Obviously you can extract the link looking for that domain name:
<?php
$data = <<<LINKS
Facebook: https://facebook.com/pumpsquadofficial Instagram: https://instagram.com/pump_squadpl DOWNLOAD MP3: http://www42.zippyshare.com/v/d6LnGjH8/file.html Some more text
LINKS;
preg_match('~(http://\w+\.zippyshare\.com/[^\s]+)~', $data, $tokens);
echo sprintf('<a href="%s">', $tokens[1]);
The output obviously is:
<a href="http://www42.zippyshare.com/v/d6LnGjH8/file.html">
I think however it makes sense to invest a few moments into the definition of what information you actually can rely on to extract that link. Is the domain really always that zippyshare.com? Or maybe you need to always extract the link following the DOWNLOAD MP3?