-1

Help me to get this character in one code

  1. 4edtee3fdpd0h8o
  2. kfz254yae7cw8fb
  3. da84s08ifannjs6
  4. a4x4c1eaki9ekw1

From this url : all of this $char

  1. httpq://199.91.153.79/c0l8y769haig/4edtee3fdpd0h8o/1-No%26Batak+%2B+JB.mp3
  2. httpq://199.91.153.63/7otxr1alp53g/kfz254yae7cw8fb/1-Yes%26metalica.mp3
  3. httpq://205.196.120.88/x0xa2u3s6utg/da84s08ifannjs6/1-Yes%26Mirrors.mp3
  4. httpq://205.196.122.248/dv6dyax7o3eg/a4x4c1eaki9ekw1/1-Yes%26reggae.mp3

Thanks before..

  • did you already tried something with substr and strpos or do you want us to do the thinking? – rene Jul 13 '13 at 11:32
  • Yes.. I have tried substr($upload['links'][0]['direct_download'],33,19) the results: /4edtee3fdpd0h8o/1- /kfz254yae7cw8fb/1- g/da84s08ifannjs6/1 g/a4x4c1eaki9ekw1/1 – Sinagaman Eidelbert Jul 13 '13 at 11:46

1 Answers1

0

you need this regex

/httpq:\/\/([\d+]{1,3}[\.|\/])+[^\/]+\/(\S+)\/.*/

example:

$str = "httpq://199.91.153.63/7otxr1alp53g/kfz254yae7cw8fb/1-Yes%26metalica.mp3";
$regex = "/httpq:\/\/([\d+]{1,3}[\.|\/])+[^\/]+\/(\S+)\/.*/";
echo preg_replace($regex, "$2", $str);
vladkras
  • 16,483
  • 4
  • 45
  • 55