我正在尝试在数字中查找重复数字组,例如12334555611
变成 (1 2 33 4 555 6 11)
.
这有效:
$n.comb(/ 0+ | 1+ | 2+ | 3+ | 4+ | 5+ | 6+ | 7+ | 8+ | 9+ /)
但不是很优雅。
有一个更好的方法吗?
最佳答案
'12334555611'.comb(/\d+ % <same>/)
Please check the answer of the first task of Perl Weekly Challenge
关于regex - 在 Raku 中查找重复数字的优雅方法(née Perl 6),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59172213/