This page uses the regular expression parser in your browser's implementation of JavaScript. This page should work with any browser that obeys the DOM, and Internet Explorer.* If you're looking for a .NET Regex tester, there's a crackerjack one here.
Test String:
| Expression | Matches |
|---|---|
| [abc] | A single character: a, b, or c |
| [^abc] | Any single character but a, b, or c |
| [a-z] | Any character in the range a-z |
| [a-zA-Z] | Any character in the range a-z or A-Z (any alphabetical character) |
| \s | Any whitespace character [ \t\n\r\f\v] |
| \S | Any non-whitespace character [^ \t\n\r\f\v] |
| \d | Any digit [0-9] |
| \D | Any non-digit [^0-9] |
| \w | Any word character [a-zA-Z0-9_] |
| \W | Any non-word character [^a-zA-Z0-9_] |
| \b | A word boundary between \w and \W |
| \B | A position that is not a word boundary |
| | | Alternation: matches either the subexpression to the left or to the right |
| () | Grouping: group all together for repetition operators |
| ^ | Beginning of the string |
| $ | End of the string |
| Repetition Operator | Meaning |
|---|---|
| {n,m} | Match the previous item at least n times but no more than m times |
| {n,} | Match the previous item n or more times |
| {n} | Match exactly n occurrences of the previous item |
| ? | Match 0 or 1 occurrences of the previous item {0,1} |
| + | Match 1 or more occurrences of the previous item {1,} |
| * | Match 0 or more occurrences of the previous item {0,} |
| Option | Description |
|---|---|
| g | "Global" -- find all matches in the string rather than just the first |
| i | "case Insensitive" -- ignore character case when matching |
| m | "Multiline" -- search over more than one line if the text contains line breaks |
By Rob Locher
* The previous version of this page
worked only with Internet Explorer. I'm sorry if it caused you any
inconvenience.