Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 2d3691778163f15eb7aed772adbbd8fd2848874c
      
https://github.com/Perl/perl5/commit/2d3691778163f15eb7aed772adbbd8fd2848874c
  Author: Yves Orton <[email protected]>
  Date:   2026-10-15 (Thu, 15 Oct 2026)

  Changed paths:
    M pod/perldelta.pod
    M regcomp_study.c
    M t/re/opt.t
    M t/re/re_tests

  Log Message:
  -----------
  regcomp: do not restrict the start class with a 0 length lookahead-assertion

For /\A(?=a*)[0-9]a\z/, study_chunk() derives a class containing 'a'
and the empty string from the STAR inside the IFMATCH. Intersecting
that class with [0-9] produces ANYOF[], so the optimizer rejects "0a"
before we even try the pattern in the regex engine proper.

With this change the resulting start class is ANYOF[0-9], and the pattern
matches.

Lookahead bodies with a positive minimum length continue to contribute
their start-class constraints. We apply the same rule to the optional
positive assertion study path.

Adds new tests which fail without the fix.

I wonder if we could be a bit more clear in the debug output that
ANYOF[] means "pattern can never match".

Fixes https://github.com/Perl/perl5/issues/24943



To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to