3 ms·
I had a hunch that maybe a lookahead might help a bit, but it turned out to be slower: /^(..+?)(?=\1+$)/ Edit: of course, silly me, +? is non-greedy.
by forinti 2y ago
I had a hunch that maybe a lookahead might help a bit, but it turned out to be slower:
/^(..+?)(?=\1+$)/
Edit: of course, silly me, +? is non-greedy.