fork download
  1. <?php
  2. $url = "Hola, visita http://www.google.com o http://w...content-available-to-author-only...k.com ahora mismo";
  3. echo preg_replace("/\b(https?:\/\/(\w+\.)?\w+\-?\.\w{2,6}(.*?))\b/is", "<a href = '$1'>$1</a>", $url);
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Hola, visita <a href = 'http://www.google.com'>http://www.google.com</a> o <a href = 'http://w...content-available-to-author-only...k.com'>http://w...content-available-to-author-only...k.com</a> ahora mismo