New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug? 5.6.0] \G in split pattern #3029
Comments
From @hvdsCreated by @hvds[fixed misassigned from/created after github migration] Not sure if this is a bug, but I thought it worth mentioning for crypt% ./perl -wle 'print join "*", split /\G(an|.)/, shift' banana I had hoped it would print something like "*b**an**an**a*". Result Perl Info
|
From @chornySame result on 5.12.0. On Sat Dec 23 00:12:51 2000, hv@crypt.compulink.co.uk wrote:
-- |
From [Unknown Contact. See original ticket]Same result on 5.12.0. On Sat Dec 23 00:12:51 2000, hv@crypt.compulink.co.uk wrote:
-- |
From @dcollinsnIs \G intended to be meaningful in an argument to split? Instrumenting two variations tells me that \G and pos() do not work within split//: dcollins@nightshade64:~/toolchain/perl/t$ ./perl -Dr -le 'print join("*", split(/(?{print "POS: " . pos() . "\n";})\G(.)/, "banana"))' EXECUTING... Matching REx "(?{print %"POS: %" . pos() . %"\n%";})\G(.)" against "banana" 0 <> <banana> | 0| 4:GPOS(5) 0 <> <banana> | 0| 4:GPOS(5) EXECUTING... Matching REx "(?{print %"POS: %" . pos() . %"\n%";})\G(.)" against "banana" 0 <> <banana> | 0| 4:GPOS(5) Matching REx "(?{print %"POS: %" . pos() . %"\n%";})\G(.)" against "anana" 1 <b> <anana> | 0| 4:GPOS(5) Matching REx "(?{print %"POS: %" . pos() . %"\n%";})\G(.)" against "nana" 2 <ba> <nana> | 0| 4:GPOS(5) Matching REx "(?{print %"POS: %" . pos() . %"\n%";})\G(.)" against "ana" 3 <ban> <ana> | 0| 4:GPOS(5) Matching REx "(?{print %"POS: %" . pos() . %"\n%";})\G(.)" against "na" 4 <bana> <na> | 0| 4:GPOS(5) Matching REx "(?{print %"POS: %" . pos() . %"\n%";})\G(.)" against "a" 5 <banan> <a> | 0| 4:GPOS(5) Matching REx "(?{print %"POS: %" . pos() . %"\n%";})\G(.)" against "" Is this /supposed/ to work? is pos() or \G in any way a feature that is useful in split//? |
/g is not allowed on a split argument, which i think might fix this. I am torn about whether we should fix this TBH. |
Migrated from rt.perl.org#5004 (status was 'open')
Searchable as RT5004$
The text was updated successfully, but these errors were encountered: