And not only
elegant++but also by far the fastest solution so far, provided Benchmark not lying to me.
Since it is also very compact already, we get the most compact variant so far with
/((??{'(.)\1*'}))/g
This is not as fast as the precompiled regex, of course, but still faster than the other snippets seen.
In reply to Re^3: Elegant way to split into sequences of identical chars?
by pKai
in thread Elegant way to split into sequences of identical chars?
by pKai
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |