Hi!
I hope the code comes out the right way.
Taken from:
http://www.koehntopp.de/php/regexp.html#regexp-bauelemente
Credits to Björn Schotte, the Author of this snipped.
$str is the input.
Call the function within your form validation after submit.
U can use this like:
$link = replace_uri($str);
$link now contains the orig. text and all converted URIs.
Volker
/**
replace URIs with appropriate HTML code to be clickable.
/
function replace_uri($str) {
$pattern = '#(|[\"=]{1})(http://|ftp://|mailto😐news🙂([\s<>]+)([\s\n<>]|$)#sm';
return preg_replace($pattern,"\1<a href=\"\2\3\"><u>\2\3</u></a>\4",$str);
}