fork(4) download
  1. <?php
  2.  
  3. $re = '/(.*?)текст(.*)/iu';
  4. $str = 'Текст
  5. ТЕКСТ
  6. ТексТ';
  7.  
  8. preg_match_all($re, $str, $matches, PREG_SET_ORDER);
  9. print_r($matches);
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => Текст
            [1] => 
            [2] => 
        )

    [1] => Array
        (
            [0] => ТЕКСТ
            [1] => 
            [2] => 
        )

    [2] => Array
        (
            [0] => ТексТ
            [1] => 
            [2] => 
        )

)