时间:2021-07-01 10:21:17 帮助过:8人阅读
$pattern = "/(abcd){1,2}.*(efgh){1,2}/";
$string = "abcd123efgh456";
preg_match_all($pattern,$string,$result);
我这样写会吧abcd和efgh都放到result数组中,我希望把abcd别放到数组里,而把efgh放到数组里,这种pattern怎么写呢?
谢谢
$pattern = "/(abcd){1,2}.*(efgh){1,2}/";
$string = "abcd123efgh456";
preg_match_all($pattern,$string,$result);
我这样写会吧abcd和efgh都放到result数组中,我希望把abcd别放到数组里,而把efgh放到数组里,这种pattern怎么写呢?
谢谢
(?:abcd)