adobe-indesigngrep-indesign

Select multiple words and characters using GREP


I need some GREP help. I'm trying to search for text in an InDesign file that has lesser-than "<" and greater-than ">" characters on either end. The text could be one word or more and could include spaces and even numbers. But, here's here's the catch, there may be multiple words on a line, such as , , <12 peaches> and <3 plums>.

I tried using <(.+)> but this picks up the whole paragraph and removes the beginning and ending brackets < > but leaves the ones in the middle.

Anyone know the proper wildcard structure that would find any text or number between these brackets and even if more than one set of "<>" appear in a single paragraph?

FYI, GREP in InDesign is not exactly the same as it's used on the web.


Solution

  • The + metacharacter is greedy meaning it tends to catch more than needed. You can restrain it with a question mark like this :

    <.+?>

    or change your pattern with

    <[^>]+>