Regular Expression for URLs using ereg_replace

/ Published in: PHP
Save to your folder(s)

Copy this code and paste it in your HTML
  1. // $subject contains a body of text with non html URLs
  2. $text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\">\\0</a>", $subject);


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.