Summary
Atomic groups ((?>...)) are not supported. An atomic group matches its contents and then gives back nothing — once the group has matched, no backtracking into it is allowed. This is useful for performance and for certain PCRE idioms.
Examples
(?>a+)b — matches ab but refuses to backtrack into a+, so does NOT match aab if b is not found immediately
(?>(\d+))\s+\1 — atomic group prevents the engine from shortening \d+ to try the backref
Impact
- Filtered from integration test suite (reported as unsupported in
testsuites/README.md)
- Prevents a class of ReDoS-immune patterns from being expressed
Implementation Notes
- Difficulty: Medium
- Files:
RegexParser.java (parse (?>), new AtomicGroupNode AST node, ThompsonBuilder.java (cut transitions after group), PatternAnalyzer.java
- Atomic groups are closely related to possessive quantifiers (see companion issue)
Summary
Atomic groups (
(?>...)) are not supported. An atomic group matches its contents and then gives back nothing — once the group has matched, no backtracking into it is allowed. This is useful for performance and for certain PCRE idioms.Examples
(?>a+)b— matchesabbut refuses to backtrack intoa+, so does NOT matchaabifbis not found immediately(?>(\d+))\s+\1— atomic group prevents the engine from shortening\d+to try the backrefImpact
testsuites/README.md)Implementation Notes
RegexParser.java(parse(?>), newAtomicGroupNodeAST node,ThompsonBuilder.java(cut transitions after group),PatternAnalyzer.java