Regex: List of Tokes
Description | Extended description | Example |
---|---|---|
A single character of: a, b or c | Matches either an a, b or c character |
|
A character except for: a, b or c | Matches any character except for an a, b or c |
|
A character in the range: a-z | Matches any characters between a and z, including a and z. |
|
A character not in the range: a-z | Matches any characters except those in the range a-z. |
|
A character in the range: a-z or A-Z | Matches any characters between a-z or A-Z. You can combine as much as you, please. |
|
Any single character | Matches any character other than newline (or including line terminators with the /s flag) |
|
Alternate - match either a or b | Matches either what is before the | or what is after it - in this case `a` or `b`. |
|
Any whitespace character | Matches any space, tab or newline character. |
|
Any non-whitespace character | Matches anything other than a space, tab or newline. |
|
Any digit | Matches any decimal digit. Equivalent to [0-9]. |
|
Any non-digit | Matches anything other than a decimal/digit. |
|
Any word character | Matches any letter, digit or underscore. Equivalent to [a-zA-Z0-9_]. |
|
Any non-word character | Matches anything other than a letter, digit or underscore. Equivalent to [^a-zA-Z0-9_] |
|
Match everything enclosed | A non-capturing group allows you to apply quantifiers to part of your regex but does not capture/assign an ID. |
|
Capture everything enclosed | Isolates part of the full match to be later referred to by ID within the regex or the matches array. IDs start at 1. |
|
Zero or one of a | Matches an `a` character or nothing. |
|
Zero or more of a | Matches zero or more consecutive `a` characters. |
|
One or more of a | Matches one or more consecutive `a` characters. |
|
Exactly 3 of a | Matches exactly 3 consecutive `a` characters. |
|
3 or more of a | Matches at least 3 consecutive `a` characters. |
|
Between 3 and 6 of a | Matches between 3 and 6 (inclusive) consecutive `a` characters. |
|
Start of string | Matches the start of a string without consuming any characters. If /m multiline mode is used, this will also match immediately after a newline character. |
|
End of string | Matches the end of a string without consuming any characters. If multiline mode is used, this will also match immediately before a newline character. |
|
A word boundary | Matches, without consuming any characters, immediately between a character matched by \w and a character not matched by \w (in either order). It cannot be used to separate non words from words. |
|
Non-word boundary | Matches, without consuming any characters, at the position between two characters matched by \w. |
|
Newline | Matches a newline character |
|
Carriage return | Matches a carriage return, unicode character U+2185. |
|
Tab | Matches a tab character. Historically, tab stops happen every 8 characters. |
|
Null character | Matches a null character, most often visually represented in Unicode using U+2400. |
|
Positive Lookahead | Asserts that the given subpattern can be matched here, without consuming characters |
|
Negative Lookahead | Starting at the current position in the expression, ensures that the given pattern will not match. Does not consume characters. |
|
Positive Lookbehind | Ensures that the given pattern will match, ending at the current position in the expression. The pattern must have a fixed width. Does not consume any characters. |
|
Negative Lookbehind | Ensures that the given pattern would not match and end at the current position in the expression. The pattern must have a fixed width. Does not consume characters. |
|
Last updated