note 51786 deleted from function.preg-replace by tularis

From: Date: Sun, 18 Jun 2006 13:26:15 +0000
Subject: note 51786 deleted from function.preg-replace by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-114311@lists.php.net to get a copy of this message
Note Submitter: anders dot carlsson at sfks dot se ---- Regarding turning an e-mail address into a mailto-link or similar, one should not forget that not all e-mail addresses follow the pattern x@y.z but sometimes x@w.y.z or even x@u.w.y.z. Thus I'm using a pattern like this: /(\\S+@\\S+\\.\\w+)/ which supposedly matches a row of non-whitespace characters (incl. punctuation, numbers etc), followed by @, another row of non-whitespace characters (including dots), at least one dot and then end with a series of "word" characters, i.e. letters. To my knowledge there is no top domain that ends with something else than a letter, maybe with the exception of foreign writing systems, but even e.g. China and Japan use .cn and .jp respectively in the end? I suppose the pattern could be split into two or more parts, e.g. if one wants to display despammed addresses. The pattern however would not work for top domains accepting email, like john.doe@com (which probably is not so common anyway).

« previous php.notes (#114311) next »