After ensuring there is data, the next basic test is if there is the right amount of data.
Are there enough characters to make a valid phone number, employee ID or password?
Data validation is where regular expressions become a Web application developer's friend.
A log-in ID or password has to have an exact match; however, the expected value of most data is unknown.
The pattern, /^[a-z$_] specifies the set of characters allowed for the first character.
It is followed by \w$/ meaning nine more valid characters reaching the end of string.
Although, since it is the last character that is unnecessary in many implementation.
This is a less commonly needed test; however, checking word count can be useful for fields where a set number of words are required or a minimum number can indicate valid data.
That lets the first and last word, which do not have spaces on both side, get counted.
The patterns don't work, however, without including the metacharacter .
One line can do a complete pattern test that would required more extensive loops and branches using string methods.Tags: Adult Dating, affair dating, sex dating