Skip to content

Support anchors: ^ $ \b \B \A \Z \z \G #16

Description

@halotukozak

Currently rejected at parse time with RegexParseError.UnsupportedFeature (see RegexParser.scala, the '^' | '$' => unsupported(...) and 'A' | 'Z' | 'z' | 'G' => unsupported(...) cases, plus \b/\B word-boundary escapes).

Anchors don't fit the pure Brzozowski-derivative model directly (derivatives consume one code point at a time and don't see "position in string" or neighboring characters), so supporting them will likely require either:

  • extending Regex/Subset with zero-width assertion nodes evaluated against surrounding context during matching, or
  • a documented restriction (e.g. only ^/\A at the very start and $/\z/\Z at the very end of a pattern, no mid-pattern anchors).

Scope for 1.0.0: at minimum ^ and $ (most commonly used); \b/\B/\A/\Z/\z/\G can follow once the mechanism is proven.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions