I'm trying to add comma separator to number string.
import re
s = '12 123 1234 12345 123456 1234567 12345678'
print(re.sub(r'(\d{3}\b)', r',\1', s))
# gives
# 12 ,123 1,234 12,345 123,456 12345,678
where:
123 should'nt have comma
1234567 should be 1,234,567
12345678 should be 12345,678