Re: Regex in PHP

From: Date: Wed, 04 Jun 2008 00:59:44 +0000
Subject: Re: Regex in PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-274976@lists.php.net to get a copy of this message
You can use this: $str = 'xxxx@yahoo.com'; preg_match('/[^@]+@(.+)/', $str, $matches);
var_dump($matches);    //will be in $matches[1]
Or without regex: echo substr($str, strpos($str, '@')+1); Liran ----- Original Message ----- From: "VamVan" <vamseevan@gmail.com> To: <php-general@lists.php.net> Sent: Wednesday, June 04, 2008 3:39 AM Subject: [PHP] Regex in PHP
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 Thanks


« previous php.general (#274976) next »