"Daniel Reichenbach" <[EMAIL PROTECTED]> writes:
> i've got a string which looks like "<[EMAIL PROTECTED]>". Now i wanted
> to check it with preg_match like this:
>
> if ( preg_match(
> '/[\<][a-z]([-a-z0-9_.])*@([-a-z0-9_]*\.)+[a-z]{2, }[\>]/i', $value ) ) {
> print "Valid mail address";
> } else {
> print "Invalid mail address";
> }
>
> Unfortunatly this doesn't work. I think, i have to use a different syntax
> for the "<" and ">" braces. Can somebody give me a hint?
According to the manual, "<" or ">" are not metacharacters, so no use
escaping them. In any case, your expression can be simlified somewhat
using Perl's \w sequence. Don't forget to designate beginning and end
of string. Try the following:
'/^<\w[\w.-]*@([\w-]+\.)+\w{2,}>$/i'
--
Arcady Genkin
i=1; while 1, hilb(i); i=i+1; end
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]