Home >Backend Development >PHP Tutorial >PHP regular expression problem? ?
<code class="php">$pattern = "/(abcd){1,2}.*(efgh){1,2}/"; $string = "abcd123efgh456"; preg_match_all($pattern,$string,$result);</code>
I will write it like this. Put abcd and efgh into the result array. I hope to put abcd into the array instead of putting efgh into the array. How to write this pattern?
Thank you
<code class="php">$pattern = "/(abcd){1,2}.*(efgh){1,2}/"; $string = "abcd123efgh456"; preg_match_all($pattern,$string,$result);</code>
I will write it like this. Put abcd and efgh into the result array. I hope to put abcd into the array instead of putting efgh into the array. How to write this pattern?
Thank you
(?:abcd)