Jump to content

Help with deprecated eregi


9999

Recommended Posts

http://www.php.net/manual/en/function.preg-match.php

 

Just use preg_match instead, and be aware that eregi was case insensitive, while preg_match is case sensitive.

It just means you need to add A-Z next to every time you use a-z, that is if you want to allow A-Z, but I suppose you do, because you were allowing that before.

 

"^[a-zA-Z0-9\._-]+@+[a-zA-Z0-9\._-]+\.+[a-zA-Z]{2,3}$"

 

Like that.

 

I don't think it's a safe code to validate input, because $ only match end of line, not end of string. \Z I think is end of string, and you should also use \A at the beginning instead of ^.

 

 

I also think there exists a function to validate emails without needing to use regex for it:

http://www.php.net/manual/en/function.filter-var.php

http://php.net/manual/en/filter.filters.validate.php

http://php.net/manual/en/filter.examples.validation.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.