fork download
  1. <?php
  2.  
  3.  
  4. $text = " sasaete.ru/ https://a...content-available-to-author-only...o.ru azaza.lol lalka@gmail.com kek avito.ru/fffuuuu/";
  5.  
  6. preg_match_all('/\s((http(s)?:\/\/)?(www.)?)?([a-zа-яё0-9]+)\.([a-z]{2,6})([a-zа-яё0-9\/_-]+)?/ui', $text, $matches);
  7.  
  8. var_dump($matches);
  9.  
  10. ?>
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
array(8) {
  [0]=>
  array(4) {
    [0]=>
    string(12) " sasaete.ru/"
    [1]=>
    string(17) " https://a...content-available-to-author-only...o.ru"
    [2]=>
    string(10) " azaza.lol"
    [3]=>
    string(18) " avito.ru/fffuuuu/"
  }
  [1]=>
  array(4) {
    [0]=>
    string(0) ""
    [1]=>
    string(8) "https://"
    [2]=>
    string(0) ""
    [3]=>
    string(0) ""
  }
  [2]=>
  array(4) {
    [0]=>
    string(0) ""
    [1]=>
    string(8) "https://"
    [2]=>
    string(0) ""
    [3]=>
    string(0) ""
  }
  [3]=>
  array(4) {
    [0]=>
    string(0) ""
    [1]=>
    string(1) "s"
    [2]=>
    string(0) ""
    [3]=>
    string(0) ""
  }
  [4]=>
  array(4) {
    [0]=>
    string(0) ""
    [1]=>
    string(0) ""
    [2]=>
    string(0) ""
    [3]=>
    string(0) ""
  }
  [5]=>
  array(4) {
    [0]=>
    string(7) "sasaete"
    [1]=>
    string(5) "avito"
    [2]=>
    string(5) "azaza"
    [3]=>
    string(5) "avito"
  }
  [6]=>
  array(4) {
    [0]=>
    string(2) "ru"
    [1]=>
    string(2) "ru"
    [2]=>
    string(3) "lol"
    [3]=>
    string(2) "ru"
  }
  [7]=>
  array(4) {
    [0]=>
    string(1) "/"
    [1]=>
    string(0) ""
    [2]=>
    string(0) ""
    [3]=>
    string(9) "/fffuuuu/"
  }
}