Announcement

Collapse
No announcement yet.

Ignore last N digits after the decimal point

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

  • Ignore last N digits after the decimal point

    What regex would I use if I wanted to ignore the last n digits after a decimal point?

    X1342.123543 and X1342.123 should match.

  • #2
    Hello,

    For BC3 Standard, the easiest method would be to define a Regular Expression that matches on the Important part of the number, and then everything else is unimportant. Would this work for your comparison?
    \d+\.\d{3}

    For BC3 Pro, you can create a Text Replacement in the Session Settings, Replacements tab. Here, create:
    (\d+\.\d{3})\d*
    RegEx that replaced with:
    $1

    This Replacement does not require you to define 'Everything Else' as unimportant, but you may need to create two replacements: one for Left to Right and one for Right to Left.

    Please let us know if you have any questions.
    Aaron P Scooter Software

    Comment


    • #3
      That worked splendidly. Thanks!

      Comment

      Working...
      X