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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:29:46+00:00 2026-06-02T20:29:46+00:00

I want to validate email address in html form. I have very little knowledge

  • 0

I want to validate email address in html form. I have very little knowledge in regex.

Validation is very simple, just to match any_symbols@any_symbols.two_to_eight_symbols pattern.

Here is the regex I’m trying to use ^.+@.+\..{2,8}$. Yet it doesn’t work, it validates pattern any_symbols@four_symbols.

Note: do not worry about such simple validation, on server side I’m doing filter_var (php) and sending token to that email. Just need to enable button on form when inputed email address fits some sane pattern 🙂

EDIT Those patterns “any_symbols…” I’ve mentioned in question are just textual representation of what I’m trying to input. This is not what I type in input field 🙂 Usually I type “test@test.com”, or “blabla@hehe.haha” and etc. 🙂

EDIT2 Actuall code:

   var email_regex = new RegExp("^.+@.+\..{2,8}$");
if ($target.val().match(email_regex) !== null){
    $button.removeAttr('disabled').removeClass('disabled');
}
else{
    $button.attr('disabled', 'disabled').addClass('disabled');
}

EDIT3 *Found the problem!* It wasn’t the regex itself, it was how I passed regex to Regex function… it should be

 new RegExp(/^.+@.+\..{2,8}$/);

not the

new RegExp("^.+@.+\..{2,8}$");

As I’ve said this whole regex thing is quite new to me :))

  • 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-02T20:29:48+00:00Added an answer on June 2, 2026 at 8:29 pm

    Suposely the regex for a real email address is not quite simple, since it should comply with an RFC standard.

    However, if this works for you, I’ve used it with no problems:

    // The regex: /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/
    
    // To test it:
    var regex = new RegExp(/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/);
    
    if( regex.test( your_string ) ){ ... } // returns true if valid
    

    If you really need to accept ANY symbols, you can use the regex that Birei posted.

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

Sidebar

Related Questions

i have very simple basic form in HTML and i want to validate the
I want to validate my email address through jquery unobtrusive validation . Like to
I want to validate a registration form that accepts an email address in the
I have a form that validates the email address and I want to be
I have a form that I want to ensure the paypal email address is
Possible Duplicate: JQuery validate e-mail address regex hi i have an input filed in
What do you use to validate an email address on a ASP.NET form. I
I want to validate a form element that is allowed to contain multiple email
I have a requirement to validate an email address entered when a user comes
I want to allow users to validate their email address by clicking on a

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.