Validations In JavaScript

Validations are required in Web Programming to insure that contradictionary & unauthorized data is not get stored in the Database.

Javascript enables the UI to Validate the fields on Client Machine which reduces burden on Server.

Validation Patterns

The Validations in Javascript can be handled by using built-in functions and Patterns. The Patterns are designed by using Meta Characters

Meta Characters Description
\d Decimal Number
\w Words [A-Za-z0-9]
\[A=Z] Uppercase
\[a-z] Lowercase
\[a-z]/[A-Za-z] Both Upper and Lowercase
\[0-9] Number
\[a,d,m,z] Specified Characters
[^,x,y,z] Excludes Specified Characters
[a-kA-K0-9] Specified range
\+\@\# Special Character Must Preside with "\"
{n,m} Minimum n and maximum m
{f,} Minimum f and Maximum any