GREP not prices

Home Forums InDesign User Groups GREP not prices


This topic contains 2 replies, has 3 voices, and was last updated by  Aaron Troia 3 years ago.

  • Author
  • #70197


    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

    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

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

You must be logged in to reply to this topic.