Re: email validation string.
| From: | Roman Neuhauser | Date: | Fri, 19 Jan 2007 17:42:01 +0000 |
| Subject: | Re: email validation string. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-247407@lists.php.net to get a copy of this message | ||
# dreasi0n.php.net@gmail.com / 2007-01-19 15:43:32 +0000:
> >
> >>>1. Why did you remove the backslash? (the original was correct)
> >>>
> >>I have a regular expression tester plugin in firefox and it validates
> >>Ok with the expression he provided.
> >>
> >JavaScript is *not* PHP.
>
> As far as I can read, I never talked about JavaScript...
> Maybe the fact that I talked about a browser made you think I was
> using Java. NO! I'm not. This is a php list and I gave my answer
> based on that. This plugin I was talking about uses PHP/5.2.0
JavaScript is *not* Java. ;) But ok, sorry about the assumption.
Where can I check out the plugin?
> In either case... Aren't both expressions supposed to validate
> an e-mail??
PHP uses one of two sets of special characters depending on whether you
use single or double quotes, and leaves a single backslash preceeding a
non-special character intact. PCRE removes backslashes if they're
followed by non-special characters (but see /X).
IOW, as opposed to PHP, PCRE will reduce \x to x for any x that's not
special. Use \\x if you want \x.
PHP will, however, reduce \\x to \x, since \ is special.
Relying on PHP's behavior with ordinary-x \x in a PCRE introduces
another grammar to the mix.
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991