Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

261
Views
PHP Find specific domain link in string

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.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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?

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!