Announcement

Collapse
No announcement yet.

Ignore 4th character after a decimal

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ignore 4th character after a decimal

    I am looking for the correct expression to ignore the 4th character after a decimal. ie:

    43.5697, 45.7089 <-- I want to only ignore the 4th decimal in every case.
    42.6785
    56.7089

    Please help!
    Thanks,
    Dave

  • #2
    Hello,

    Would you be looking to ignore this character in Text files or files you are opening in the Data Compare?

    In the Text Compare, the definition must match the exact character you wish to ignore, and can't be dependent on other "if" characters. As such, we cannot define "if 3 preceeding numbers, make the 4th unimportant."

    We can, however, make a grammar element that matches on the number itself, then mark all other text as unimportant. This would make "43.569" important, and everything else unimportant. How would the rest of your file be constructed, so we can make a grammar that matches on the other text other than the preceding number?

    To match on the Important part of the number, you can use the grammar element:
    \d+\.\d{3}

    And make sure in the Session Settings, Importance tab, that element name is checked and all other elements and Everything Else is unchecked.
    Aaron P Scooter Software

    Comment


    • #3
      I managed to find a way (I think) to isolate the 4th decimal using a delimited grammar item:

      Text from: \x2E\d\d\d (Hex "decimal" character followed by 3 number wildcards)

      To: \s (whitespace)

      This is when I discovered that not all the numbers in my file are 4 decimal places. Some are whole numbers, some are 3 decimal, etc.
      So, I'm hooped I think!


      Thanks,
      Dave

      Comment


      • #4
        Hello,

        That grammar will match on the first 3 digits as well, including them as part of the unimportant text. If that's ok, then this definition would work.
        Aaron P Scooter Software

        Comment


        • #5
          Also, without End At End of Line, this definition could keep going if there is no 'space' after the last digit.
          Aaron P Scooter Software

          Comment

          Working...
          X