fork download
  1. <?php
  2.  
  3. $re = '~(?:8768|9875|2353).*(?:\R(?!\R).*)*~iu';
  4. $str = '8768 text text
  5. text
  6.  
  7. 868123
  8. text
  9. text
  10. text.text
  11.  
  12. 9875 text
  13. text
  14.  
  15. 2353
  16. text
  17. text';
  18. $subst = '';
  19.  
  20. preg_match_all($re, $str, $ms);
  21.  
  22. echo "The result of the substitution is ". print_r($ms);
Success #stdin #stdout 0s 52488KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => 8768 text text
text
            [1] => 9875 text 
text
            [2] => 2353
text
text
        )

)
The result of the substitution is 1