ereg_replace.php : ereg_replace « String « PHP






ereg_replace.php

 
<?php
   $text = "http://www.java2s.com/.";
   echo ereg_replace("http://([a-zA-Z0-9./-]+)$", "<a href=\"\\0\">\\0</a>", $text);
?>
  
  








Related examples in the same category

1.back-reference parenthesized substrings
2.ereg_replace
3.ereg_replace() function searches for string and replaces pattern if found.
4.ereg_replace-2
5.Using ereg_replace