Branch: refs/heads/yves/hydahy_gh18032 Home: https://github.com/Perl/perl5 Commit: 12d9d972e1e6d0f79c915e80e43b1fe2619c2538 https://github.com/Perl/perl5/commit/12d9d972e1e6d0f79c915e80e43b1fe2619c2538 Author: Richard Leach <richardle...@users.noreply.github.com> Date: 2024-03-08 (Fri, 08 Mar 2024)
Changed paths: M ext/re/re.pm M pod/perlfunc.pod M pod/perlre.pod M regcomp.c M t/op/split.t Log Message: ----------- regcomp.c - Exclude split STRING from /x default modifiers. We have a magic special case with split STRING where if the STRING is a single space character we trigger awk emaulation mode, which causes split to ignore leading whitespace, and to split on \s+. When default regex modifier support was added to perl we didn't notice that it doesn't make sense for the /x modifiers to change the behavior of a STRING pattern in split. STRING patterns are NOT parsed using the normal pattern parsing rules, for instance "\s+" would split on 's' characters, not on whitepace. The /x modifier is designed to change the rules for *pattern* parsing, most notably by adding support for comments and ignoring whitespace in pattern definitions. This feels to me like a feature that should only apply to cases where a true pattern is parsed, such as where \s+ would be treated as the special pattern for matching whitespace and not a literal 's' character. Historically there was NO way to create a string pattern with the /x pattern enabled, to enable /x the string MUST have been fed into a true pattern parsing construct like qr// m// or s///. By excluding STRING patterns from /x notation, we ensure that the special case of awk emulation for C<split " "> is preserved. Note that a default /x modifier *does* change the behavior of C<split / />, as the pattern in that case is parsed the same as C<split qr/ /> or C<m/ />. With changes by Yves Orton Fixes #18032 To unsubscribe from these emails, change your notification settings at https://github.com/Perl/perl5/settings/notifications