Wednesday, August 15, 2007

Formatting phone numbers in InDesign

In a previous Blog entry I wrote about the new GREP search capability in InDesign CS3. Today I hammered out the following GREP string for a client, and thought I'd share it here, hoping you might find it useful.

The procedure below allows you to search for U.S. phone numbers in almost any format, and replace them with numbers in the format (800) 555-1212 with a non-breaking space after the area code and a non-breaking hyphen before the last four digits. This is a variation on the GREP string included with InDesign that formats phone numbers in "dot" format.

1. Start InDesign, and choose Edit > Find/Change

2. Copy the string below into the Find what: field.

\(?(\d\d\d)\)?[-.\s~~]?(\d\d\d)[-.\s~~]?(\d\d\d\d)

3. Copy the string below into the Change to: field

($1)~S$2~~$3

4. Click on the small disc icon at the top of the Find/Change dialog box, and give the Query a name. Now, any time that you want to find and change phone numbers you can just choose this name from the Query drop-down list, indicate the scope of the search, and click on the Find button.

1 comment:

Anonymous said...

Great tip – Thank you!
Could this be done with a nested style? And if yes how?
Help would be greatly apreciated

Best
Steph