Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

GREP – Bold dollar amounts only

Return to Member Forum

  • Author
    Posts
    • #14349610
      Geoffrey West
      Participant

      I have a multi-page price list in a 2-column table, and I’m trying to create a bold character style for JUST the dollar values:

      “$3.00 / bag”
      “15.00 each”
      “45.00 per cubic yard”

      I’ve come close with this expression: (?<=)\d

      That’s picking up the cents, period and dollar values but not the dollar sign itself.

      But that’s also picking up instances of things like “30#” and other numeric values.

      What’s the missing ingredient?! HELP!

    • #14349613
      David Blatner
      Keymaster

      I wonder if this will work: \$?\d+\.\d\d
      That will search for a $ (zero or one), followed by one or more digits, followed by a dot, and then 2 more digits.

    • #14349621
      Dhafir Photo
      Participant

      If the price in beginning of paragraph always, you can use this:

      (?s)^\$?\K\d[.\d]+

    • #14349629
      Geoffrey West
      Participant

      Thanks, guys!

      Just for snips and gibbles, is there a method using one of the look behind/ahead commands that would accomplish this as well?

      Just curious if I was on the right track going that route when I first started. I always wanted to use one of the look ahead/behind commands but never know the appropriate instance or styling challenge.

      • #14349636
        David Blatner
        Keymaster

        Well, you wanted to include the $ symbol, so no, not really. Positive Lookbehind would be for something like: “Find a digit that comes immediately after a $ — but don’t include the $ symbol.”

        Though you could use a negative lookahead, for example, to say “find any number unless it is followed by a # symbol.”

Viewing 3 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads