- //g
- Options:
-
- Options:
var regex = //;
var input = "your input string";
if(regex.test(input)) {
var match = input.match(regex);
alert(match);var matches = input.match(regex);
for(var match in matches) {
alert(matches[match]);
}
} else {alert("No matches found!");}
Our Work
| Shortcut |
Equivalent Character Set |
Comment |
| \d | [0-9] | digit |
| \D | [^0-9] | nondigit |
| \s | [ \t\n\r] | whitespace |
| \S | [^ \t\n\r] | nonwhitespace |
| \w | [a-zA-Z0-9] | "word char" |
| \W | [^a-zA-Z0-9] | "word separator" : i.e. space or punctuation, also not EOL or BOL |
| [\s\S] | [ALL CHARACTERS WITH NEW LINE AND SPACE] | |