Regular Expressions in JavaScript

Regular expressions, also known as regex, are simply ways to describe text patterns.  Regex can be very useful in many situations, for example when you need to look for  errors in a large file or retrieve the browser agent a user is using. They can also be  used for form validation, as with regex you can specify valid patterns for field entries such as email addresses or phone numbers.
This article covers use of Regex in JavaScript