Skip to content

regex fails to backtrack from an empty alternative to a matching alternative #5572

Closed as not planned

Description

@robertmorelli

Describe the bug
The regex pattern /^(?:(?:\s(?:(?:){0,1}|a))+)+$/ fails to match "\u2028a".

To Reproduce

console.log(/^(?:(?:\s(?:(?:){0,1}|a))+)+$/.test("\u2028a")); // prints false

Expected behavior
prints true

Build environment:

  • OS: macOS
  • Version: 27.0 (build 26A428)
  • Target triple: aarch64-apple-darwin
  • Rustc version: rustc 1.99.0 (b940084d7 2026-09-28) (Homebrew)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions