Thanks to visit codestin.com
Credit goes to www.slideshare.net

JavaScript RegEx -
Examples
Matching a Username
 the input name should only contains a-z, 0-9, and -,_
 The input name should be minimum of 3 letters and maximum of 13.
Matching a Username
/^[a-z0-9_-]{3,16}$/
 Description:
 We begin by telling the parser to find the beginning of the string (^),
followed by any lowercase letter (a-z), number (0-9), an underscore, or
a hyphen. Next, {3,16} makes sure that are at least 3 of those
characters, but no more than 16. Finally, we want the end of the string
($).
 String that matches:
 my-us3r_n4m3
 String that doesn't match:
 th1s1s-wayt00_l0ngt0beausername (too long)
Matching a Password
Matching a Password
Matching a Hex Value
Matching a Hex Value
Matching a Slug
Matching a Slug
Matching an Email
Matching an Email
Matching a URL
Matching a URL
Matching an IP Address
Matching an IP Address
Matching an HTML Tag

3.2.1 javascript regex example