Re: Regex in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I can't find any good reason for regex in this case.
you can try to split it with explode / stristr / create a function by your
own which goes over the string and check when a @ is catched, something
like:


function GetDomainName ($a)
{

$returnDomain = "";
$beigale = false;
for ($i = 0; $i < strlen($a) && !$beigale; $i++)

if ($a[$i] == '@')
{

for ($z = ($i+1); $z < strlen($a); $z++)
$returnDomain .= $a[$z];
$beigale = true;
}
return $returnDomain;
}



(there is probably a better way to do this - this is just what came up at my
mind right now..)

On 04/06/2008, VamVan <vamseevan@xxxxxxxxx> wrote:
>
> Hello All,
>
> For example I have these email addressess -
>
> xxxx@xxxxxxxxx
> xxxx@xxxxxxxxxxx
> xxxx@xxxxxxxxx
>
> What would be my PHP function[Regular expression[ to that can give me some
> thing like
>
> yahoo.com
> hotmail.com
> gmail.com
>
> Thanks
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux