I've got this regex:
(/(\d{2})(\d{3})(\d{2})/g;
What I want to do is to replace every 2, when every 3 and when every 2 again character with a " " while typing. Which means if I type "123" it should be formatted to "12 3" and if I type "12345" it should be formatted to "12 123 "
However I get a spacing only after every 7 character. Here's a jsfiddle: http://jsfiddle.net/K4WXc/257/
Help would be highly appreciated!
123456and1234567,123465789?return v.replace(/\d(?=(\d{3})+$)|^\d(?=\d{2}$)/g, "$& ");and let know if that meets your requirements.v.replace(/^(\d{2}) ?(\d{3})?(?=\d)/g, "$1 $2 ");