GREP not prices

Learn / Forums / InDesign User Groups / GREP not prices

Tagged: 

Viewing 2 reply threads
  • Author
    Posts
    • #70197
      nellbern
      Member

      Would like to find all prices instances on a document & replace them with a tab

      The following grep expression works:
      note: i’m using \\ escape characters because i’m using applescript

      (\\$?)\\d+\\.\\d{2} which find any prices including or not the $ symbol Example: $1.99 $12.99 $445.99 15.99 4.99
      this one works too [[=$=]]?[[:digit:]]?[[:digit:]][[=.=]][[:digit:]][[:digit:]]

      but it’s also find digits that fall on the same category but they are not prices. Like: 1.99 oz or 22.45 lts or 5.44 ozs & it’s replace them with a tab leaving the word oz, lts & ozs. I tried lookahead (\\$?)\\d+\\.\\d{2}(?! OZ|oz|lts|ozs) but still it doesn’t work. What am i’m doing wrong?

    • #70257
      Masood Ahmad
      Participant

      Would it be possible for you to provide some more text with a desired output (manually). I’m unable to figure out what applescript has to do with your prices. In your example, I can’t see any backslashes.

    • #70859
      Aaron Troia
      Participant

      You might try grouping your alternations like (?! (OZ|oz|lts|ozs)) or (?! (?:OZ|oz|lts|ozs)) so that it’s non-capturing.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
>