-1

帮助我在一个代码中获取此字符

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

从这个网址:所有这些 $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

之前谢谢。。

4

1 回答 1

0

你需要这个正则表达式

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

例子:

$str = "httpq://199.91.153.63/7otxr1alp53g/kfz254yae7cw8fb/1-Yes%26metalica.mp3";
$regex = "/httpq:\/\/([\d+]{1,3}[\.|\/])+[^\/]+\/(\S+)\/.*/";
echo preg_replace($regex, "$2", $str);
于 2013-07-13T11:44:44.893 回答