Back to Blog
Grep indesign5/18/2023 More flexibility is offered by so-called character classes. This simple GREP, then, finds centre, centres, center, and centers. The question mark says that the s should be matched if present, otherwise not. Optionality adds more flexibility: to find both the singular and plural forms of these alternatives, search for cent(re|er)s?. For example, to find both centre and center, search for cent(re|er) alternatives are separated by pipe symbols ( ?|?). The GREP expression \u\l finds an upper-case letter \u followed by one or more lower-case letters \l . Figure \d matches the literal text Figure followed by any number (2, 34, 121, etc.): \d stands for digit, the plus sign means “at least one”. For example, you can look for series of digits rather than for a single digit. In contrast, with GREP you mainly look for patterns. The four wildcards in the Text tab are useful, though rather limited – for instance, you can’t use them for replacements, only for searching. When you use any of these wildcards, you’re no longer looking for literal text, but for a pattern. Thus with Figure^w^9 you search for the literal text Figure followed by any space, followed by a digit. But in the Text tab you can use some wildcards: ^9 finds any digit, ^$ stands for any letter, ^? matches any character, and ^w is used to find any whitespace. InDesign’s text search is used mainly for searching literal text: when you search for cats, you find just that (disregarding settings such as case-sensitivity and whole-word only). But first a quick comparison with InDesign’s Text search, which is useful because the comparison reveals GREP’s strength. It may be easiest to see how GREP works with a few examples. This is an excerpt from GREP in InDesign by Peter Kahrel.
0 Comments
Read More
Leave a Reply. |