Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

What is the best Regular Expression to validate an email address in PHP?

Damian99Damian99 USAMember Posts: 116

I need to know the best regex to catch a valid email address for my web app. Please help.

Comments

  • newmindcorenewmindcore YekaterinburgMember Posts: 1

    I am using this
    '/[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/is'
    in most cases

  • DavidMDavidM USAMember Posts: 342

    Well, there is no PERFECT regex for this. The best way is coding your app to validate the email by confirmation where you will send an email to that email address with a confirmation link. Until the confirmation is done, you can limit access to your site.

    This tutorial nicely explains how to setup confirmation.

Sign In or Register to comment.