Created
April 30, 2018 05:50
-
-
Save chetanppatil/550209597e4613e75385396ddfdf2f06 to your computer and use it in GitHub Desktop.
Most commonly used regex, ES6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const phoneRegx = RegExp(/^[0]?[789]\d{9}$/) | |
const emailRegx = RegExp( /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/) | |
let phoneNumber = '9999999999' | |
let email = '[email protected]' | |
console.log('PHONE REGX:= ', phoneRegx.test(phoneNumber)); | |
console.log('EMAIL REGX:= ', emailRegx.test(email)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment