Re: Regex in PHP

From: Date: Wed, 04 Jun 2008 03:32:09 +0000
Subject: Re: Regex in PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-274977@lists.php.net to get a copy of this message
On Tue, Jun 3, 2008 at 8:39 PM, VamVan <vamseevan@gmail.com> wrote: > Hello All, > > For example I have these email addressess - > > xxxx@yahoo.com > xxxx@hotmail.com > xxxx@gmail.com > > What would be my PHP function[Regular expression[ to that can give me some > thing like > > yahoo.com > hotmail.com > gmail.com if you know the values are valid email addresses, use a combination of strripos() and substr(). it will be nice a fast that way. as an aside, this is what the manual says on preg_match() Do not use *preg_match()* if you only want to check if one string is contained in another string. Use strpos()<http://www.php.net/manual/en/function.strpos.php>or strstr() <http://www.php.net/manual/en/function.strstr.php> instead as they will be faster. and the case insensitive versions are a hair faster still ;) -nathan

« previous php.general (#274977) next »