Adobe InDesign CC 2015 User Manual
Page 234
229
Text
Last updated 6/6/2015
You can use the Found Text expressions to refer to these groupings. For example, $0 refers to all found text, and $2 refers
to only the second grouping. By inserting $2 in the Change To field and specifying a character style in the Change
Format field, you can search for a word within quotation marks, and then replace the word with a character style.
Because only $2 is specified, the $1 and $3 groupings are removed. (Specifying $0 or $1$2$3 in the Change To field
would apply the character style to the quotation marks as well.)
A Finds all word characters enclosed in quotation marks B The character style is applied to the second grouping (the word) while the first and
third groupings (open and close quotes) are removed
C Character style specified
This example searches only for single words enclosed in quotation marks. If you want to search for phrases enclosed in
parentheses, add wildcard expressions, such as (\s*.*\w*\d*), which looks for spaces, characters, word characters, and
digits.
Example 2: Phone numbers
InDesign includes a number of search presets that you can choose from the Queries menu. For example, you can choose
the Phone Number Conversion query, which looks like this:
\(?(\d\d\d)\)?[-. ]?(\d\d\d)[-. ]?(\d\d\d\d)
Phone numbers in the United States can appear in a variety of formats, such as 206-555-3982, (206) 555-3982,
206.555.3982, and 206 555 3982. This string looks for any of these variations. The first three digits (\d\d\d) of the phone
number may or may not be enclosed in parentheses, so a question mark appears after the parentheses: \(? and \)?. Note
that the backslash \ indicates that the actual parenthesis is being searched for and that it’s not part of a subexpression.
The brackets [ ] locate any character within them, so in this case, [-. ] finds either a hyphen, a period, or a space. The
question mark after the brackets indicate that the items within it are optional in the search. Finally, the digits are
enclosed in parentheses, which signify groupings that can be referred to in the Change To field.
You can edit the grouping references in the Change To field to suit your needs. For example, you could use these
expressions:
206.555.3982 = $1.$2.$3
206-555-3982 = $1-$2-$3
(206) 555-3982 = ($1) $2-$3