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

Styling an * inside a table with GREP? Or nested styles?

Return to Member Forum

  • Author
    Posts
    • #14346760
      Geoffrey West
      Participant

      Dear Gods of GREP…

      I’m working on a calendar design using tables for each month. I have a request to add an [*] after certain dates and I’d like to style just the asterisk (date is one color, asterisk is another). I tried nested styles using digits as my parameter (up to 2 digits), but all the single-digit dates (1-9) don’t change when I go that route. My goal is to build this into a paragraph style, then package that into my cell/table style set-up to speed up the workflow.

      I feel like I’m missing one vital piece to make this work. Should I be using nested styles or is there a GREP expression that would work better?

      Help!

    • #14346761
      David Blatner
      Keymaster

      GREP Styles cannot add text, like an asterisk. You’d have to add that with something like a Find/Change. But after that, it’s not hard with grep styles to set up a pattern like: “Apply a color to all the asterisks that follow a number”

    • #14346765
      Geoffrey West
      Participant

      Sorry, I was not clear in my initial write-up. The asterisks are already after the numbers, I was trying to change their colors only separate from the digits themselves. I said “add” but used it incorrectly.

      Do I need separate GREP expressions for single and double-digit numbers, or will one work for both?

    • #14346767
      David Blatner
      Keymaster

      Ah! OK, that sounds good.
      The grep code \* will search for all asterisks.
      The grep code (?<=\d)\* will search for "all asterisks that immediately follow a digit"
      The code \d+\K\* will search for "all asterisks that follow a slash followed by one or more digits"
      Here is one challenge, though: If you have fractions that can cause problems. For example, these codes do not know the difference between 1/2 and 9/11.

    • #14346905
      Massimo Carrassi
      Participant

      You could assign a paragraph style to all dates and, in the Grep Style, assign the font style with the desired colour only to the character *.

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