Given the following input:
123456781234567812345678
I am trying to accomplish the following:
12345678,12345678,12345678
Right now the work to accomplish this currently reads as:
parts = parts.replace(/\B(?=(\d{8})+(?!\d))/g, ",");
The issue I am getting is that the regex reads from right to left. I have created a JSFIDDLE to show the issue. The result I get is something like.
123,45678910,12345678
Lastly when I use the arrow keys to move around, it throws me back to the end of the input.