Special Tokens
exactly`(yes/no)`
\(yes\/no\)
Match the given string literally, escaping all special characters
lineFeed
\n
Match a line feed character
not.lineFeed
not(lineFeed)
[^\n]
Match anything other than a line feed
carriageReturn
\r
Match a carriage return character
not.carriageReturn
not(carriageReturn)
[^\r]
Match anything other than a carriage return
backspace
[\b]
Match a backspace character
not.backspace
not(backspace)
[^\b]
Match anything other than a backspace
tab
\t
Match a tab character
not.tab
not(tab)
[^\t]
Match anything other than a tab
verticalWhitespace
\v
Match a vertical whitespace character
not.verticalWhitespace
not(verticalWhitespace)
[^\v]
Match anything other than a vertical whitespace
formFeed
\f
Match a form feed character
not.formFeed
not(formFeed)
[^\f]
Match anything other than a form feed
nullChar
\0
Match a null character
not.nullChar
not(nullChar)
[^\0]
Match anything not null
octal`123`
octal('123')
[\123]
DEPRECATED
Match a character with the given code point in base-8 †
not.octal`123`
not(octal('123'))
[^\123]
DEPRECATED
Match anything other than the specified character
hex`3f`
hex('3f')
\x3f
Match a character with the given code point in base-16 ‡
not.hex`3f`
not(hex('3f'))
[^\x3f]
Match anything other than the specified character
unicode`3ef1`
unicode('3ef1')
\u3ef1
Match a character with the given code point in base-16 ‡
not.unicode`3ef1`
not(unicode('3ef1'))
[^\u3ef1]
Match anything other than the specified character
control`j`
control('j')
control`J`
control('J')
/\cj/
/\cJ/
Match a control character with value equal to the given letter's character value modulo 32
Only a letter from a
to z
or A
to Z
is allowed
not.control`j`
not(control('j'))
not.control`J`
not(control('J'))
/[^\cj]/
/[^\cJ]/
Match anything other than the specified control character
† Notes on octal
octal
Octal escape sequences (\ followed by one, two, or three octal digits) are deprecated in string and regular expression literals. Please avoid using them as much as possible.
The RegExp output of octal
is always wrapped in a character class to disambiguate it from capture group back-references.
The maximum allowed value is 0o377
, which is equivalent to 0xff
.
‡ Notes on hex
and unicode
hex
and unicode
Both have the same effect, but hex
uses the single-byte escape sequence \xff
if possible, while unicode
always uses the 2-byte sequence \uffff
.
Last updated