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.

Capture

Have fun!