Re: Regex in PHP

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

 



On Tue, Jun 3, 2008 at 8:39 PM, 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


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

[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