Keywords
One line: One page per construct — every anchor, class, quantifier, group and control verb — each with a table produced by handing the same rows to eight engines, so the page says what \b or (?>…) or $1 does, per engine, rather than what a cheat sheet says it means.
The chapters are organised by question. This shelf is organised by syntax: it is where to go when you are looking at a pattern and want to know what one piece of it means in the engine you are holding. Topics is the third cut — one page per job, pulling keywords and chapters together.
How a keyword page is made
Every table on this shelf comes from one program, tools/kwprobe/run.py ↗, which takes rows of label, pattern, subject and asks eight engines the same question: does it compile, does it match, and what exactly did it match. The engines are Python (3.12, the CI runner's version), Perl, JavaScript (Node), Ruby, Java, Go, and Rust's regex and fancy-regex crates. A cell is the matched text, no for compiled-but-no-match, - for refused, and n/a where the driver was told not to ask because the answer depends on a runtime version that differs between the author's machine and CI.
Two consequences worth knowing before reading a table. A - is good news — the engine told you it does not have the feature. A no next to a - is the cell to look at: it often means the engine compiled the construct as something else (JavaScript's identity escapes, Rust's (?R) flag, Ruby's \pL) and the page will say so. And PCRE2 — which is ABAP's engine — has no column, because nothing on the CI runner speaks it; where it matters a page carries a dated pcre2grep run instead.
Anchors and boundaries
| Keyword |
Page |
In one line |
^ |
Start of subject, or of a line, or "not" |
A line anchor always in Ruby, only under m elsewhere; negation or a literal inside a class |
$ |
The end, plus one newline you did not ask for |
Steps over a final newline in four engines, any newline in Ruby, none in JavaScript, Go, Rust |
\A, \z, \Z |
The anchors that mean what ^ and $ are assumed to mean |
Python's \Z is Perl's \z; JavaScript has none of them and matches the letters |
\b, \B |
A boundary is wherever \w says it is |
Ruby's \b and \w disagree with each other; Rust's regex has GNU's \< \> |
\G |
Where the last match ended |
The tokenizer anchor, with a lexer in Perl and Java |
Characters and classes
| Keyword |
Page |
In one line |
. |
Any character, except the ones it is not |
Refuses \n everywhere and \r in two engines; the flag is s, or m in Ruby |
[…] |
A set of characters, and the two whose position matters |
] first, - last, and && set arithmetic in Ruby, Java and Rust only |
\d, \w, \s |
And \h, \v, \R, \N |
ASCII in four engines, Unicode in four; \v is a vertical tab in five |
[[:alpha:]] |
POSIX bracket classes |
Four engines have them, four read the same text as a class of six characters |
\p{…} |
A character by what it is |
Three spellings for one script, no spelling all engines take; Python has none |
\X |
One character as a person counts it |
Perl, Ruby and Java keep a family emoji whole; . splits it everywhere |
Quantifiers
| Keyword |
Page |
In one line |
*, +, ? |
Zero or more, one or more, at most one |
x* always succeeds; x** is legal in Ruby and Rust |
{n,m} |
Counted repetition |
{,2} is a quantifier in four engines and the literal text in two |
*?, +? |
As little as possible |
Same answer in all eight; POSIX reads a+? as (a+)? |
*+, ++ |
Greedy, and never gives it back |
a++a cannot match — except in Rust, where ++ is (a+)+ |
Groups and references
| Keyword |
Page |
In one line |
(…) |
A group that remembers |
Numbered by opening bracket, keeps the last iteration, unset on the other branch |
(?:…) |
A group that does not count |
And its scoped-flag form (?i:…) |
(?<n>…) |
Three ways to name a group, four to refer to it |
No definition spelling and no reference spelling that all eight accept |
\1 |
Match the text group 1 matched |
Unset groups, forward references and \10 — five answers to one escape |
$1, \1, ${n} |
The replacement string is a second language |
Fourteen rows, no universal spelling, and two engines that insert a NUL |
(?|…) |
Alternatives that share group numbers |
Perl and PCRE2 only |
| |
This or that, in this order |
First alternative that works wins, in all eight — order is meaning |
Lookaround and control