Project

General

Profile

Actions

Bug #22430

open

regex counted group with a zero-width iteration misses a match

Bug #22430: regex counted group with a zero-width iteration misses a match

Added by robertmorelli (Robert Morelli) about 16 hours ago.

Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 4.0.7 (2026-09-15 revision 229531a6cf) +PRISM [arm64-darwin27]
[ruby-core:127081]

Description

repro:

/\A(?:a|^){2}\z/.match?("a")     # true
/\A(?:a|^){2,3}\z/.match?("a")   # false
/\A(?:\B|a){3}\z/.match?("aa")   # false
/\A(?:^a*){2,3}\z/.match?("a")   # false

Perl and Python return true for all four. Possibly same family as #22418.

No data to display

Actions

Also available in: PDF Atom