Skip to main content
Participant
December 6, 2018
Answered

Price Grep Style

  • December 6, 2018
  • 2 replies
  • 563 views

So far I have this grep style, that allows the digits after the decimal to change to a different character style.

However, I need the decimal place to also be in the same style (see below)

Does anyone have any tips/ideas how I could achieve this?

This topic has been closed for replies.
Correct answer hammer0909

When you use a positive lookbehind as you are, it won't affect the characters that you're looking for although it does help to avoid inadvertently formatting elements. jmlevy's suggestion should work, but I'd still to the positive loosbehind for a digit so that it only finds the period followed by two digits when it comes after another digit. Try the below expression because I don't think you'll ever have more than two digits after the period no?

(?<=\d)\.\d{2}

2 replies

hammer0909
Community Expert
hammer0909Community ExpertCorrect answer
Community Expert
December 6, 2018

When you use a positive lookbehind as you are, it won't affect the characters that you're looking for although it does help to avoid inadvertently formatting elements. jmlevy's suggestion should work, but I'd still to the positive loosbehind for a digit so that it only finds the period followed by two digits when it comes after another digit. Try the below expression because I don't think you'll ever have more than two digits after the period no?

(?<=\d)\.\d{2}

jmlevy
Community Expert
Community Expert
December 6, 2018

Did you try this?

\.\d+