- Pass a string to RegExp or create a regex using the
//
syntax - Call
regex.test(string)
, notstring.test(regex)
So
jQuery(function () {
$(".mail").keyup(function () {
var VAL = this.value;
var email = new RegExp('^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$');
if (email.test(VAL)) {
alert('Great, you entered an E-Mail-address');
}
});
});
Related Contents:
- Check whether a string matches a regex in JS
- Regex to replace multiple spaces with a single space
- jQuery selector regular expressions
- split string only on first instance of specified character
- Extract hostname name from string
- Regular expression to match non-ASCII characters?
- Return positions of a regex match() in Javascript?
- How to convert a Title to a URL slug in jQuery?
- Javascript regex returning true.. then false.. then true.. etc [duplicate]
- Insert space before capital letters
- Regex to Match Symbols: !$%^&*()_+|~-=`{}[]:”;’?,./
- Javascript + Regex = Nothing to repeat error?
- javascript regex for password containing at least 8 characters, 1 number, 1 upper and 1 lowercase [duplicate]
- Including a hyphen in a regex character bracket?
- jQuery javascript regex Replace with \n
- What does the “Nothing to repeat” error mean when using a regex in javascript?
- jQuery remove special characters from string and more
- Regex for allowing alphanumeric,-,_ and space
- How can I select an element by ID with jQuery using regex?
- Regular expression [Any number]
- RegEx that will match the last occurrence of dot in a string
- regular expression to match exactly 5 digits
- Smooth scrolling when clicking an anchor link
- How to prevent a click on a ‘#’ link from jumping to top of page?
- How to remove and clear all localStorage data [duplicate]
- jQuery .ready in a dynamically inserted iframe
- How can I validate google reCAPTCHA v2 using javascript/jQuery?
- Show loading image while $.ajax is performed
- Bootstrap Modals keep adding padding-right to body after closed
- JavaScript REST client Library [closed]
- change url without redirecting using javascript [duplicate]
- What is the difference between jQuery’s mouseout() and mouseleave()?
- Prevent form redirect OR refresh on submit?
- How do you cache an image in Javascript
- Verify External Script Is Loaded
- JQuery .hasClass for multiple values in an if statement
- How to check if any JavaScript event listeners/handlers attached to an element/document? [duplicate]
- Using fadein and append
- Twitter Bootstrap button click to toggle expand/collapse text section above button
- How to emulate background-size: cover on ?
- Javascript: How to read a hand held barcode scanner best?
- Uncaught TypeError: Cannot read property ‘createDocumentFragment’ of undefined
- How to Compare two Arrays are Equal using Javascript? [duplicate]
- FullCalendar header buttons missing
- Get selected element type
- Return true/false for a matched/not matched regex
- JS library (with drag n drop) compatible with iOS and regular browsers
- Execute function after Ajax call is complete
- Javascript regex for matching/extracting file extension
- Jquery post, response in new window