Regular expression helps you in pattern matching in string. : Matches any single charcter except a new line : Matches the preceding character or repeated character. The basic expression for matching entered value as number in the field is: /^[0-9] $/.
Checking for form completion: The first step of form validation is to check, whether the user have entered information in all the fields or not.
If the string value is numeric, it will return true, otherwise it will return false.
[a-z] : It matches characters from lowercase ‘a’ to lowercase ‘z’. If by mistake, user skips entering any detail, soon the alert message appear on the form.
escaping - by -) [0-9] : It matches digital number from 0-9. That means, you could be very sure about the form, whether users have entered the details or not.
Validation codes will return an alert message, if it finds some empty fields in the form.