Jump to content

changing an eregi regular expression to work with preg_match


hisuwh
 Share

Recommended Posts

I have this regular expression which worked with eregi, which is now deprecated but i dont know how to get it to work with preg_match.Help would be much appreciated.Cheers

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

Link to comment
Share on other sites

$needle = "/^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$/";if(preg_match($needle, $haystack)) {//whatever}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...