Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 3
    The correct answer was already given, but regarding the deprecated issue: The usage of POSIX regular expressions (which eregi is a function of) is deprecated. Use PCRE instead. Commented May 2, 2011 at 10:09
  • 3
    By the way, your regex is totally wrong. Some totally valid adresses will be marked as invalid by your function. Filtering email adresses with a regex is a nightmare. Commented May 2, 2011 at 10:19
  • You should use RFC 822 standard and here is a good article Parsing Email Adresses in PHP that explains it. Commented Jan 6, 2014 at 17:34
  • Stay away from regex and filter_var() solutions for validating email. See this answer: stackoverflow.com/a/42037557/953833 Commented Feb 4, 2017 at 7:16