Every so often, the question is raised how to add delimiters (commas, or thin spaces, etc.) between groups of 3 digits in long numbers in InDesign.
It would seem like this is something a clever GREP search could do, but in fact it is not so easy as it seems. In fact, I’m not sure it’s possible with a single simple GREP.
However, it is certainly possible with a script.
To use the script below, select something GREPable (text, a text frame, etc.), and run. Choose from the dropdown list the style of formatting you want. The available options are based on The Chicago Manual of Style (15th edition, chapter 9.23).
You can also choose to ignore numbers that are only 4 digits long (this might be useful to avoid formatting 4-digit years as well).
Click here to download the script: FormatLongNumbers
Here’s a screenshot.
Have fun!

David Blatner
November 21, 2014 12:19 amThis looks great. Thanks! Glad you can ignore 4-digit numbers. Years ago, when I was working on Judaism For Dummies, all the history chapters came back from the editor with commas in the dates, like “the year 1,492.” They must have used some sort of macro.
Admin
November 24, 2014 3:00 pmThanks David. Sure, I think the 4-digit thing is useful. Although right now it’s an either/or proposition — if you don’t want a comma in years, but you do want it elsewhere, you’ll have to run the script twice.