I'm trying to format some strings with delimiters using regex, and its almost done, but my delimiter continues to appear at end of string.
For example, I have this code:
var myString = "abcdefghi"
var result = myString.replace(/(.{1,3})(?:(?=.{3})\.(.{1,3})(?:(?=.{3}))?)?/g, '$1.');
console.log(result) // abc.def.ghi.
And I am expecting abc.def.ghi