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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:37:12+00:00 2026-06-05T03:37:12+00:00

How to create a method that check if an email is valid, if the

  • 0

How to create a method that check if an email is valid, if the validator find an ‘@’ sign?
(the input text is either name or email address only).

  • 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-05T03:37:14+00:00Added an answer on June 5, 2026 at 3:37 am
    function checkMail(email){
        var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        if (filter.test(email)) {
            return true;
        }
        return false;
    }
    
    checkMail('me@domain.com'); // return true or false if invalid.
    

    This will check the e-mailaddress additionally if a valid domain is written.

    me@something –> invalid
    @something.com –> invalid
    me@.com –> invalid
    me@something.com –> valid

    Regular Expression Library –>

    If you want to validate the mail address with jQuery Validation Engine, simply add:

    data-validation-engine="validate[required,custom[email]]"
    

    to the input field.


    Since Form Validation Engine 1.6.4, there’s the possibility to add your own function for validation: http://www.position-absolute.com/news/form-validation-engine-1-6-4/

    You can replace the code in the example with this, then it should work:

    <input value="" data-validation-engine="validate[required,funcCall[nameOrMail]]" class="text-input nameOrMail" type="text" name="req" id="req" />
    

    JS (To your <head>):

    jQuery(document).ready(function(){
        jQuery("#formID").validationEngine({
            "nameOrMail": {
                "nname":"nameOrMail"
            }
        });
    });
    
    function checkMail(email){
        var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        if (filter.test(email)) {
            return true;
        }
        return false;
    }
    
    function nameOrMail(){
        if($(".nameOrMail").val().indexOf('@') >= 0){
            if(!checkMail($(".nameOrMail").val())) {
                return "Please enter a valid mail address or name!";
            }
        } else {
            if($(".nameOrMail").val() === '') {
                return "Please enter a valid mail address or name!";
            }
        }
    }
    

    Live demo: http://jsfiddle.net/4dUyX/

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

Sidebar

Related Questions

Im trying to create a method that take 2 int array as the input
I am trying to create an form validator class that will check to make
I want to create a method that takes two variables timeIn and timeOut and
I am trying to create a method that can detect the encoding schema of
I'm trying to create a method that will sum two timeO objects and return
I would like to create a method that takes an event as an argument
I am trying to create a method that accepts multiple types of controls -
I'm trying to create a method that will allow me to set properties within
I am using ARC and want to create a method that passes in an
I want to create a method sum that I can call on different types,

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.