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 Style to Find text by Character Count

Return to Member Forum

  • Author
    Posts
    • #62597
      justiz2010
      Member

      This is a spin-off from this conversation from a couple of years back.

      https://creativepro.com/for…..aracters-3

      A 8045166 OUR STUFF WATERMELON/STRAWBERRY DRINK MIX SUGAR SWEETENED
      K 15/12 OZ 7 44234-80271 8 15 8 $PRICE ($PRICE) $PRICE ($PRICE)

      Above is the typical data I am dealing with. Our item#'s are always 7 digits followed by a tab and then a product description and then another Tab. (This data is live linked to an Excel table and brought in as Unformatted Tabbed text.)

      I would like to be able to use a GREP style to look for “PRODUCT DESCRIPTION” text that is 56-65 characters and apply a character style with a slightly compressed horizontal text so that it doesn't creep into the folowing column. I would like to also add other GREP styles to look for text from 66-75 characters and appply a slightly more compressed text. And so on. (We are currently doing this manually using a character style, but everytime we update changes from the Excel file the data comes from we have to go back and reapply the style)

      This is what I have:

      MY GREP CODE

      The issues I am having is that the “.” “Any Character” wildcard is too broad and is ignoring my tab boundary. And /w [/l/u/d] aren't working.Is there another way of forcing it to look ONLY between the 2 tabs and still read Upper and Lower case letters and spaces?

      There is discussion in this thread between Jongware and Eugene Tyson on how to fix that, but it isn't working for me. And to be honest my understanding of GREP is fairly basic so I am sure I am missing something.

      Any help would be GREATLY appreciated. (Oh and we use ID CS4)

      Thanks!!

      Izzy

    • #62918
      Anonymous
      Inactive

      I have used the grep supplied by Jongware and it seems to works fine. The GREP parses as 'look for any character string, as long as it is between 55 and 75 chars, as long as it is preceded by 7 digits and a tab and followed by a tab.'

      I dont know if this will help, but when I type out GREP I always get the backslash and forward slash the wrong way round which immediately kills the code. I can also recommend JW's WhatThe GREP script.

    • #62941
      justiz2010
      Member

      Thanks for the feedback. Sorry for not coming back to this post, we got into our ctatlog season and I am just now up for air before we get into the next one.

      This is what I ended up using.

      [^t]{56,59}

      [^t]{60,63}

      [^t]{64,47}

      And yes Jongware's grep did finally work for me. I have no idea why it didn't at first, but I am assuming it was a fleshware error on my part.

      This is REALLY handy for us and I have resued this bit of code accross several books. It is AN AMAZING timesaver.

      Well when my team actually uses it.

      Thanks for the mention of the WhatTheGREP script. https://www.jongware.com/idgrephelp.html

      I will check it out.

      Once again thanks Salieri.

    • #90399
      Donna Morris
      Member

      I want to change style Based on character count

      [^*]{1,100} = Small text — 18pt — This works in my Paragraph style
      [^*]{101,250} = Medium text — 16pt — but I lose my styles
      [^*]{251,400} = Normal text — 14pt
      [^*]{401,1000} = Large text — 10 pt

      I see the word Mixed in the Character Style Panel when I test the switches.

      Can anyone help? Thanks

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