Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6786247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:13:21+00:00 2026-05-26T17:13:21+00:00

Is there a good way to check a form input using regex to make

  • 0

Is there a good way to check a form input using regex to make sure it is a proper style email address? Been searching since last night and everybody that has answered peoples questions regarding this topic also seems to have problems with it if it is a subdomained email address.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:13:22+00:00Added an answer on May 26, 2026 at 5:13 pm

    There is no point. Even if you can verify that the email address is syntactically valid, you’ll still need to check that it was not mistyped, and that it actually goes to the person you think it does. The only way to do that is to send them an email and have them click a link to verify.

    Therefore, a most basic check (e.g. that they didn’t accidentally entered their street address) is usually enough. Something like: it has exactly one @ sign, and at least one . in the part after the @:

    [^@]+@[^@]+\.[^@]+
    

    You’d probably also want to disallow whitespace — there are probably valid email addresses with whitespace in them, but I’ve never seen one, so the odds of this being a user error are on your side.

    If you want the full check, have a look at this question.


    Update: Here’s how you could use any such regex:

    import re
    
    if not re.match(r"... regex here ...", email):
      # whatever
    

    Python ≥3.4 has re.fullmatch which is preferable to re.match.

    Note the r in front of the string; this way, you won’t need to escape things twice.

    If you have a large number of regexes to check, it might be faster to compile the regex first:

    import re
    
    EMAIL_REGEX = re.compile(r"... regex here ...")
    
    if not EMAIL_REGEX.match(email):
      # whatever
    

    Another option is to use the validate_email package, which actually contacts the SMTP server to verify that the address exists. This still doesn’t guarantee that it belongs to the right person, though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a good way to create a form in VB6 that can easily
Is there a good way to time SQL queries when using Linq to SQL?
Is there a good way to check if an entire application (not an activity!)
In Javascript, is there a good way to check if a variable was ever
Is there any good way to deal with the class renaming refactor from Resharper
Is there a good way for displaying unicode text in opengl under Windows? For
Is there a good way to see what format an image is, without having
Is there a good way to find out which exceptions a procedure/function can raise
Is there a good way to read RAW image files (especially Canon CR2 and
Is there a good way to add a .swf programatically to a panel on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.