Skip to content

[feature] Atomic groups not supported ((?>...)) #41

@jbachorik

Description

@jbachorik

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions