Jump to content

changing an eregi regular expression to work with preg_match


hisuwh

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

Archived

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

×
×
  • Create New...