The Len & Mid bits are to stop initials, or people putting in "S J ". And no single person has more than three or four names total?
There is probably a more elegant way of doing this but I'm rather fresh to REGEX. And no doubt the same person will forever be identifiable by the same name?
Fortunately, Java Script 1.2 has incorporated regular expressions.
In this article I will present a brief tutorial on the basics of regular expressions and then give some examples of how they can be used to simplify data validation.
Last month I wrote about regular expressions in Java, today I’ll show you how to use regular expression in Java Script to validate email address.
Here is the code to validate email address in Java Script using regular expression.
indicates the minimum and maximum number of characters.
If the input email address satisfies our regular expression, ‘test’ will return true otherwise it will return false. You can call this method whenever you want to validate email address.
Validating user input is the bane of every software developer’s existence.
When you are developing cross-browser web applications this task becomes even less enjoyable due to the lack of useful intrinsic validation functions in Java Script.
Once you master the pattern language, most validation tasks become trivial.
You can perform complex tasks that once required lengthy procedures with just a few lines of code using regular expressions.