I would use explode to make an array then look at each item in the array to determine if it;s an email address or a website address (i.e. does it have a "@" and a".", if so it's an email address. Does it start with "www.", if so it's a website).
something like this
$TheString = "For information on ordering, please contact John at john@somesite.com or visit us at www.somesite.com";
$StringArray=explode(" ",$TheString);
For($Counter=0;$Counter < Count($StringArray); $Counter++){
if(strpos($StringArray[$Counter],"@") != FALSE && strpos($StringArray[$Counter],".") != FALSE) {
Print"<a href=\"mailto:$StringArray[$Counter]\">$StringArray[$Counter]</a>"." ";
}elseif(strpos($StringArray[$Counter],"www.")=== 0 || strpos($StringArray[$Counter],"Http://www.")=== 0){
Print"<a href=\"$StringArray[$Counter]\">$StringArray[$Counter]</a>"." ";
}else{
Print $StringArray[$Counter]." ";
}
}