$pattern = "/'(.+?)'=>['(.+?)',(\d+)]/"; $text = "'cctv1'=>['301',0],//汶上综合频道\n'cctv17'=>['301',1],//汶上生活频道";

preg_match_all($pattern, $text, $matches);

for ($i = 0; $i < count($matches[0]); $i++) { $channel = $matches[1][$i]; $code = $matches[2][$i]; $index = $matches[3][$i]; echo $channel . ",['" . $code . "'," . $index . "]\n"; }

$txt=cctv1=3010汶上综合频道cctv17=3011汶上生活频道;使用php正则输出文字汶上综合频道3010汶上生活频道3011

原文地址: https://www.cveoy.top/t/topic/i8HA 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录