2 Replies Latest reply on Jun 8, 2010 1:03 PM by BSAphex

# [CS4] GREP - price description

Hello,

I've been trying to figure out a way to apply a GREP style to the last two digits in a number.

For example, in the number 4999 I'd like to apply a superscript to just the last two digits so it appears as a price.

But I can't seem to figure out a GREP expression that selects just those two digits (i.e. the cents in price). If the number is only 3 digits total, say 799, I want the same result, so the superscripting only affects the cents. Obviously, if there were decimals separating the cents from the dollars it would be much easier, but this is not the case unfortunately.

Sincerely,

BSAphex

• ###### 1. Re: [CS4] GREP - price description

Maybe this:

(?<=\d)\d\d\b

that is, two word-final digits preceded by at least one digit. So that captures the last two digits of all numbers that are at least three digits long.

Peter

• ###### 2. Re: [CS4] GREP - price description

Hi Peter,

That worked perfectly. Thanks so much for your help.

I guess I need to keep practicing. Using a positive LookBehind makes sense now. Hopefully these things will be more clear to me in the future.

Well, this has solved one expression conundrum. I'll take a crack at the next one myself. Wish me luck and brain cells.

Cheers,

BSAphex