Home > Article > Backend Development > PHP regular problem, I want to match and split where (rn) appears twice
<code>$str = "fhd\r\n\r\nfdfk\r\n\r\nuuuuu"; $data = preg_split("(\r\n){2}", $str, -1); print_r($data); </code>
Result:
<code>$str = "fhd\r\n\r\nfdfk\r\n\r\nuuuuu"; $data = preg_split("(\r\n){2}", $str, -1); print_r($data); </code>
Result:
<code> $str = "fhd\r\n\r\nfdfk\r\n\r\nuuuuu"; $data = preg_split("/(\r\n){2}/", $str, -1); print_r($data);</code>