No announcement yet.

Ignoring embedded numbers

  • Filter
  • Time
  • Show
Clear All
new posts

  • Ignoring embedded numbers

    I have files where the left one might say WS123-END-GAME and the right one might say WS246-END-GAME and in one file I may have thousands of these. What I need to do is to ignore the embedded numbers in the comparison.

    I tried the following:-
    Create two lines of Replacements
    1. [*=1]Left: WS\d\d\d (regex) Right: WS000 [*=1]Left: WS000 Right: WS\d\d\d (regex)
    I tried it first with just line (1), and then again with both lines, but it makes no difference - the strings are still flagged as a difference whereas I need them to be treated as an acceptable match.

    I also (in addition) tried setting and unsetting Ignore Minor Differences but that made no difference.

    Is there any good way to achieve my objective?

  • #2

    That double pair of RegEx's should work, but would need to be updated to "246" instead of "000" (or whichever literal pattern you are trying to match on). If the number is constantly changing, it would not be expected to define 999 different Replacements for Left and another 999 for Right. Would it be better to define WS\d\d\d as generally unimportant? Are there any scenarios where even if it weren't aligned, it would be aligned to another Unimportant definition (or nothing at all) that might skip it?

    Generally making WS\d\d\d unimportant anywhere in the file is covered here:

    Once the text is defined (either as a Replacement or Unimportant grammar), it will appear Blue if it is different instead of Red. Blue Unimportant Differences are still Differences unless you toggle on the Ignore Unimportant Differences toolbar, which then switches Blue to Black and treats them as if they were Same/equal text.
    Aaron P Scooter Software


    • #3
      That's really useful - thanks - yes, I can say that the pattern WS\d\d\d is unimportant. I'll give that a try tomorrow - if it works it will save me loads of time.