Start a new topic

RegEx for Decimal Position

Hi,

I need to format an import field to 2 decimal positions.  Date can come in as 4, 3.9, 3.92 or 3.985 (it's the GPA).  I need to replace it with 4.00, 3.90, 3.92 or 3.98.  I have a dictionary that works for 0, 1 or 2 decimal positions but not 3.

Any help would be greatly appreciated.  Here is my dictionary:

Replacement value - $&.00 regex - value to match on ^\d?$

Replacement value - $&.0 regex - value to match on ^\d+(\.\d{1})?$

I'm OK with the values to match on - I can just modify the above one to account for the number of decimals coming in.  I'm having trouble with the replacement value. I can't get it to "strip" off the 3rd decimal.

Thanks.

Lisa

Login or Signup to post a comment