The catastrophic backtracking solution described where atomic groups are emulated using lookahead and backreferences is useful but can be tricky to use and error prone (e.g. when quantifying the result, or in longer patterns that rely on multiple atomic groups). So this adds a link to an easy to use solution that enables the direct use of atomic groups via (?>…) in native JS regexes.
Atomic groups don't capture, so I changed "atomic capturing groups" to "atomic groups" (their correct name).
The emulation trick (with a backreference to a capturing group inside a lookahead) emulates an atomic group, not a possessive quantifier, so I corrected this. This distinction is subtle since possessive quantifiers are sugar for some common uses of atomic groups, but it is important. For example, the lookahead/capture trick accurately emulates the behavior of an atomic group like (?>…|…) which is not followed by a quantifier at all.
The catastrophic backtracking solution described where atomic groups are emulated using lookahead and backreferences is useful but can be tricky to use and error prone (e.g. when quantifying the result, or in longer patterns that rely on multiple atomic groups). So this adds a link to an easy to use solution that enables the direct use of atomic groups via
(?>…)
in native JS regexes.