Created
December 30, 2014 19:47
-
-
Save caionitro/98150f1974f99979beb7 to your computer and use it in GitHub Desktop.
letters and numbers regex
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
var letters = /^[A-Za-z]+$/; | |
var numbers = /^[0-9]+$/; | |
if(name.match(letters) && name.length <=15){ | |
alert("do something!"); | |
}else{ | |
alert("Please Enter Name in Alphabet only..."); | |
} | |
if(price.match(numbers) && price.length <=5){ | |
alert("do something!"); | |
}else{ | |
alert("Please Enter Price in Number only..."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment