Say only
what it can mean.
Use short rules. Errors show a line and column. Quoted text stays literal.
START HERE
A complete rule
start "ABC"
3 digits
end/^ABC\d{3}$/uMatches ABC123
Rejects ABC12, ABC1234
Use line start and line end for line-based matching. Line anchors add JavaScript's m flag. Input and line anchors cannot be mixed.
Without m, start and end match only the true input edges. They reject a final line break; m makes line anchors match each line.
BUILDING BLOCKS
Match one thing
| Instruction | Source | Meaning |
|---|---|---|
any character | . | One character, except a line break unless s is on |
any text | .* | Longest text up to the next rule. s includes line breaks. |
word / not word | \w / \W | ASCII letters, digits, underscore / everything else |
digit / not digit | \d / \D | ASCII digit / anything else |
letter | [A-Za-z] | One ASCII letter; excludes digits and underscores |
letters | [A-Za-z]+ | One or more ASCII letters |
hex digit | [0-9A-Fa-f] | One ASCII hexadecimal digit, in either letter case |
hex digits | [0-9A-Fa-f]+ | One or more hexadecimal digits; no prefix or separators |
space / not space | \s / \S | JavaScript whitespace / anything else |
digits | \d+ | One or more digits |
"ABC" | ABC | Exact quoted text; regex punctuation is escaped |
one of: a, b | [ab] | One listed character |
none of: a, b | [^ab] | One character outside the list |
letter and letters are not Unicode alphabetic classes: they exclude é by default. With i, JavaScript case folding also matches equivalents such as K and ſ; the explanation reports this. Use 3 letters or a range to limit the count.
text without: a, b matches zero or more characters outside that list. Add start and end to check the whole string. Quote punctuation and spaces in lists, for example one of: "]", "-", " ". Each item must be one Unicode code point. A literal can contain multiple characters.
Use straight JSON double quotes, such as "A". Single quotes, backticks and smart quotes are not string delimiters; unsupported quoted literals and list entries offer a repair hint. Quote characters remain valid matching data inside JSON strings or as individual list items.
Unicode direction controls and C1 control characters appear as visible escapes such as \u202e and \u009b in regexes and explanations. Line separators are also displayed as escapes. Matching still uses the original values. Ordinary Arabic and Hebrew letters and emoji stay unchanged.
Lone UTF-16 surrogates are literal data, escaped for copying. Matching uses Unicode code points: joining a trailing high surrogate to a leading low surrogate forms a new astral character. A repeated literal such as 2 "\udc00A\ud800" therefore does not match that string's JavaScript .repeat(2) value.
HOW MANY
Repeat one thing
Put counts or ranges first: 3 digits generates \d{3}, and between 2 and 4 digits generates \d{2,4}. digits, hex digits and letters mean one or more unless a count or range replaces that default. any text and text without already match sequences.
| Form | Source | Count |
|---|---|---|
3 <item> (for example, 3 digits) | {3} | Exactly three |
between 2 and 4 <item> | {2,4} | Two, three or four; both bounds included |
Both counts must be integers from 0 to 1,000, with the upper count at least the lower. between 0 and 1 "-" allows an optional hyphen. A multi-character literal stays together: between 2 and 4 "AB" generates (?:AB){2,4}.
Write counts with digits 0–9; leading zeros are allowed. A sign, fraction, scientific notation or localized digit produces a count error. Every count needs an item: use 3 digits, rather than 3 alone.
Ranges try the largest count first, then backtrack if the next rule needs it. Add start and end to validate the entire string; an unanchored range can find part of a longer string.
BOUNDARIES
Flags and limits
u alwaysUnicode regex mode is always enabled.
i and s optionalChoose ignore case or dot matches newlines in the workshop or CLI.
m from line anchorsLine anchors enable multiline behavior automatically.
Rules are limited to 16,384 UTF-16 code units, 200 lines and numeric repetition counts up to 1,000. The workshop limits example strings and runs matching in a time-limited worker. These limits do not guarantee that a copied regex is fast in another program.
A missing closing quote points to the actual line end, including trailing spaces. Raw control characters inside unfinished quotes still report their own position. Whitespace after a closed quoted value is ignored.
Groups, alternation, lookaround, raw regex injection and other regex engines are outside this language version. Read the full language contract ↗, or the local Markdown source ↗ when offline.