$txt=cctv1=3010汶上综合频道cctv17=3011汶上生活频道;使用php正则输出文字30103011
You can use the following PHP code to extract the desired text using regular expressions:
$txt = "'cctv1'=>['301',0],//汶上综合频道
'cctv17'=>['301',1],//汶上生活频道";
$pattern = "/\['(\d+)',(\d+)\]/";
preg_match_all($pattern, $txt, $matches);
print_r($matches[0]);
This code will output:
Array
(
[0] => ['301',0]
[1] => ['301',1]
)
Please note that the regular expression pattern assumes that the desired text is enclosed in square brackets with a single quote before the opening bracket. If the actual format of the text is different, you may need to modify the regular expression pattern accordingly.
原文地址: http://www.cveoy.top/t/topic/i8Hq 著作权归作者所有。请勿转载和采集!