Without using pipes, an easy way to answer your question with javascript is:
var str = "The quick brown fox jumps over the lazy dogs.".replace(/(.{2})/g,"$1,");
And this will output Th,e ,qu,ic,k ,br,ow,n ,fo,x ,ju,mp,s ,ov,er, t,he, l,az,y ,do,gs,.
But I think that you have formulated your question poorly, so if you want to parse numbers, you should use this function:
function numberWithCommas(x) { var parts = x.toString().split("."); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); return parts.join("."); }
So
var num = numberWithCommas(1234567); console.log(num);
This will exit 1,234,567