Common RegEx:
| JavaScript | |
|---|---|
| Numeric | /^[0-9]+$/ | 
| Alphabets | /^[a-zA-Z]+$/ | 
| Alphanumeric | /^[0-9a-zA-Z]+$/ | 
| /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/ | 
| Expression | Description | 
|---|---|
| [abc] | Find any character between the brackets | 
| [^abc] | Find any character NOT between the brackets | 
| [0-9] | Find any character between the brackets (any digit) | 
| [^0-9] | Find any character NOT between the brackets (any non-digit) | 
| (x|y) | Find any of the alternatives specified | 
Methods:
| Method | Description | 
|---|---|
| exec() | Tests for a match in a string. Returns the first match | 
| test( | Tests for a match in a string. Returns true or false | 
| toString() | Returns the string value of the regular expression | 
For tutorial you can visit: w3schools
 
 
                   
No comments