Daevid Vincent a écrit :
Maybe I misunderstood the OP,
  OP ?

but wouldn't this (or something like it) be
easier and cleaner than that mess below??
  No, it's dirty too.

$url = preg_replace("/(\...@\w+\.[a-za-z]{2,3})/i", "<a
href='mailto:$1'>$1</a>", $url);
This violate the numerous RFC about mail addresses, and some other stuffs.

$url = preg_replace("/\s(http:\/\/)?(\w*\.?\w*\.[a-zA-Z]{2,3}.*?\s)/i", " <a
href='http://$2' target='_blank'>$2</a>", $url);

Same as previously. What about .info, .museum and so on tld ? The filter_var is well suited for this kind of job. Oh, and your regex isn't smart (you use the case insensitivity flag, but seek A-Z characters...) :D

Mickaël Wolff aka Lupus Michaelis

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to