preg-replace-PHP preg_replace和爆炸函数



我有一些像这样的原始数据

u002522u00253Au002522httpsu00253Au00255Cu00252Fu00255C

我的意图是删除\u002522https\this之间每个字符串的反斜杠"\"和前7位。为此,输出将仅为https。

如果只有像这样的7位数\u002522\,输出将为空。

我的最终意图是将每个结果放入一个数组中,该数组是为上述原始数据格式化的,如

Array
(
      [0] => 
      [1] => 
      [2] => https
      [3] => 
      [4] => 
      [5] => 
      [6] => 

)

我想要这个结果来构建一个URL。我已经尝试过使用preg_replaceexplode函数来获得预期的结果,但我失败了。

$text = 'u002522u00253Au002522httpsu00253Au00255Cu00252Fu00255C\';
$text = preg_replace("#(\\[a-z0-9]{7})#is",",",$text);
$text_array = explode(",",trim($text,'\'));
print_r($text_array);

最新更新