How do I evaluate only the digits after a decimal in a number?

53 Views Asked by At

I am using ExamDiff to compare two *.csv files which have no spaces after commas. Numbers in the files contain between 2 and 8 decimal places but I only want to evaluate the first 3 digits after the decimal - anything beyond the thousandth place is insignificant.
ExamDiff allows you to use Regex to ignore certain parts of lines so I'm using: (\d{1,4}\.) to identify the number string (but also ignore it which is Ok in these cases).
Here's a sample line from the csv:

VQ000009,B2,B3,VV,12.0000,0.23,1.0000,1.0000000000,1357.421

And here's the comparable line in the new CSV:

VQ000009,B2,B3,VV,12.0000,0.27,1.0009,1.0000000000,1357.431

So, in this example the 0.23 and 0.27 would flag the 1.0000 and 1.0009 would not flag, and the 1357.421 and 1357.431 would flag

1

There are 1 best solutions below

0
NetMage On BEST ANSWER

The web site isn't clear as to how much of the Boost library is supported, but if full PCRE is supported, you can use this to ignore:

(?<=\.\d{3})\d+

This says match any digits that are preceded by a . and 3 digits. Note that if you have something like VQ.123456 the 456 will match and be ignored. Stray . will cause issues.