Free JavaScript Regular Expression Validator
Regular expressions are a powerful tool for performing pattern matches in Strings in JavaScript. You can perform complex tasks that once required lengthy procedures with just a few lines of code using regular expressions.» More details on Mozilla Developement Center
» More compatibility details on aptana.com
Validator
RegExp Pattern:
Flags:
Input text:
Methods:
Replace by:
Special characters in regular expressions
Character | Meaning |
---|---|
\ |
For characters that are usually treated literally, indicates that the next character is special and not to be interpreted literally. For example, -or- For characters that are usually treated specially, indicates that the next character is not special and should be interpreted literally. For example, |
^ |
Matches beginning of input. If the multiline flag is set to true, also matches immediately after a line break character. For example, |
$ |
Matches end of input. If the multiline flag is set to true, also matches immediately before a line break character. For example, |
* |
Matches the preceding item 0 or more times. For example, |
+ |
Matches the preceding item 1 or more times. Equivalent to For example, |
? |
Matches the preceding item 0 or 1 time. For example, If used immediately after any of the quantifiers Also used in lookahead assertions, described under (?=) |
. |
(The decimal point) matches any single character except the newline character. For example, |
(x) |
Matches 'x' and remembers the match. These are called capturing parentheses. For example, |
(?:x) |
Matches 'x' but does not remember the match. These are called non-capturing parentheses. The matched substring can not be recalled from the resulting array's elements |
x(?=y) |
Matches 'x' only if 'x' is followed by 'y'. For example, |
x(?!y) |
Matches 'x' only if 'x' is not followed by 'y'. For example, |
x|y |
Matches either 'x' or 'y'. For example, |
{n} |
Where For example, |
{n,} |
Where For example, |
{n,m} |
Where For example, |
[xyz] |
A character set. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen. For example, |
[^xyz] |
A negated or complemented character set. That is, it matches anything that is not enclosed in the brackets. You can specify a range of characters by using a hyphen. For example, |
[\b] |
Matches a backspace. (Not to be confused with |
\b |
Matches a word boundary, such as a space. (Not to be confused with For example, |
\B |
Matches a non-word boundary. For example, |
\cX |
Where X is a letter from A - Z. Matches a control character in a string. For example, |
\d | Matches a digit character. Equivalent to [0-9] .
For example, |
\D |
Matches any non-digit character. Equivalent to For example, |
\f |
Matches a form-feed. |
\n |
Matches a linefeed. |
\r |
Matches a carriage return. |
\s |
Matches a single white space character, including space, tab, form feed, line feed. Equivalent to For example, |
\S |
Matches a single character other than white space. Equivalent to For example, |
\t |
Matches a tab. |
\v |
Matches a vertical tab. |
\w |
Matches any alphanumeric character including the underscore. Equivalent to For example, |
\W |
Matches any non-word character. Equivalent to For example, |
\n |
Where n is a positive integer. A back reference to the last substring matching the n parenthetical in the regular expression (counting left parentheses). For example, |
\0 |
Matches a NUL character. Do not follow this with another digit. |
\xhh |
Matches the character with the code hh (two hexadecimal digits) |
\uhhhh |
Matches the character with code hhhh (four hexadecimal digits). |