<code class="php">$pattern = "/(abcd){1,2}.*(efgh){1,2}/"; $string = "abcd123efgh456"; preg_match_all($pattern,$string,$result);</code>
我这样写会吧abcd和efgh都放到result数组中,我希望把abcd别放到数组里,而把efgh放到数组里,这种pattern怎么写呢?
谢谢
<code class="php">$pattern = "/(abcd){1,2}.*(efgh){1,2}/"; $string = "abcd123efgh456"; preg_match_all($pattern,$string,$result);</code>
我这样写会吧abcd和efgh都放到result数组中,我希望把abcd别放到数组里,而把efgh放到数组里,这种pattern怎么写呢?
谢谢
(?:abcd)