I need a regex that can capture strings in groups of three, but if the remaining characters are not divisible by three, I want them grouped in twos.
For example:
123456
should be123 456
1234567891011
should be123 456 789 10 11
Could someone please assist me with this?
I attempted (.{1,3})(.{3}|.{2}) but it didn't work as expected.