GREP not prices
- This topic has 2 replies, 3 voices, and was last updated 9 years, 6 months ago by .
- You must be logged in to reply to this topic.
Learn / Forums / InDesign User Groups / GREP not prices
Learn / Forums / InDesign User Groups / GREP not prices
Tagged: GREP
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?
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.
You might try grouping your alternations like (?! (OZ|oz|lts|ozs)) or (?! (?:OZ|oz|lts|ozs)) so that it’s non-capturing.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies allows us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
To provide the best experiences, we and our partners use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us and our partners to process personal data such as browsing behavior or unique IDs on this site and show (non-) personalized ads. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Click below to consent to the above or make granular choices. Your choices will be applied to this site only. You can change your settings at any time, including withdrawing your consent, by using the toggles on the Cookie Policy, or by clicking on the manage consent button at the bottom of the screen.
You have to be logged in to save.
Not a member? Join Today - it's FREE!