You are here: Re: Email regex « All PHP « IT news, forums, messages
Re: Email regex

Posted by MS on 09/28/85 11:49

> Try adding this before the last closing parethesis above:
> !== false

I tried this with no better results...

But i did figure out what was going on....

if(eregi("^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\
..)|(([ a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", $email)){

// In here was a redirect function... the redirect was being called but the
script after this "if" was continuing to be processed.

Redirect(page.php);

// Adding the Die(); here stopped the script.
die();
}


Thanks for your help !!
--
----------------------------------------------------------------------------
http://www.myclubweb.co.uk - The Home of Club Websites
----------------------------------------------------------------------------


"Kim Andrι Akerψ" <kimandre@NOSPAMbetadome.com> wrote in message
news:4e8cplF1dbrjqU1@individual.net...
> MS wrote:
>
> > I know this seems simple, but I am totally confused with the following
> >
> > if(eregi("^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\
> > .)|(([ a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", $email)){
> > ....
> > }
> >
> > it supposedly check for a valid email format !!
> > But I am getting the impression that this check is not being
> > completed.
> >
> > it makes no difference what the value of $email is I cannot get the
> > expression to be True !!
> >
> > What am I doing Wrong?
>
> Trouble with using ereg() and eregi(), that they return the index
> position of the string found, which can be 0, which also can evaluate
> as false in an if() statement.
>
> Try adding this before the last closing parethesis above:
> !== false
>
> This will make sure that if the string is a valid e-mail adress, the
> if-statement will return true. The extra = sign makes sure that "false"
> will match on type (boolean) as well as value.
>
> --
> Kim Andrι Akerψ
> - kimandre@NOSPAMbetadome.com
> (remove NOSPAM to contact me directly)

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация