<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)