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 8975571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:54:56+00:00 2026-06-15T18:54:56+00:00

I am trying to create a user validation form to check the e-mail and

  • 0

I am trying to create a user validation form to check the e-mail and also run it against my database. However, if there is an e-mail, such as “my.name@domain.com”, it will put it into the database anyway, even if it is a duplicate entry.

if (preg_match("/^([a-zA-Z0-9z])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $_POST['e-mail'])) {
       //regular expression for email validation
        $Email = $_POST['e-mail'];
    } else {
         $error[] = 'Your EMail Address is invalid  ';
    }

How would I change preg_match to look for the period in there? BTW, all users registering for the site will have a period in their e-mail (it is only for a select group of people that have the same e-mail format).

  • 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-06-15T18:54:57+00:00Added an answer on June 15, 2026 at 6:54 pm

    Your minimum goal is making sure that there’s at least one period in the local part of the email address, because your specific use case requires this. We can probably bit a bit naive and use

    /.*\..*@/
    

    as the main check. This searches for zero or more of anything, one period, then zero or more of anything, then an at sign. This will successfully make sure that there’s at least one dot in there, where it matters. Consider changing the *s to +s unless you want the string .@ to pass this check. I’m not sure where you expect the period, and can’t remember off the top of my head whether or not periods are allowed as the first or last characters in the local part.

    Combine this with a call to filter_var($_POST['e-mail'], FILTER_VALIDATE_EMAIL) to actually check the full formatting of the address.

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

Sidebar

Related Questions

I'm trying to create a form validation. I added @user.errors.add_to_base TEST to my controller,
I am trying to create an email validation form for my database but am
Hello there i'm trying to create a form with Zend_Form that will enable my
I'm trying to create a pretty standard user creation form for a website I'm
I'm trying to create a form which allows the user to define own custom
I'm trying to create user profiles for my site where the URL is something
I'm trying to create User Control which will work like a rich button. It's
Im trying to create a user control menu where links to a page's usercontrols
I'm trying to create a User Registration page in ASP.NET and wondering what is
I'm trying to create a user control in WPF to represent a Go board

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.