fork(1) download
  1. <?php
  2.  
  3. $text = '
  4. first line without links
  5. <a title="bla-bla" href="http://content-available-to-author-only.ru/">second string linelink </a>
  6. third line';
  7.  
  8.  
  9. $pattern = '/^(?>(?!(\<a.*href)|\<\/a).)*$/umi';
  10. $result = preg_match_all($pattern, $text, $matches);
  11. print_r($matches);
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => 
            [1] => first line without links
            [2] => third line
        )

    [1] => Array
        (
            [0] => 
            [1] => 
            [2] => 
        )

)