fork download
  1. <?php
  2.  
  3. $pattern = '~http://([A-Za-z0-9.-]*)~';
  4. $text = "http://www.google.com";
  5. $text = preg_replace($pattern,'<a href="\0">\0</a>',$text);
  6. echo $text;
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
<a href="http://www.google.com">http://www.google.com</a>