Announcement

Collapse
No announcement yet.

Feature request: Specify left/right in search/replace regex

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

  • Feature request: Specify left/right in search/replace regex

    I find myself often having two files that need to be processed in a simple, robotic way, but BC can't handle it. It would help immensely if BC allowed the possibility to specify left/right for individual components in search/replace RegExes. For example, the following 2 files:

    File 1
    A = 1
    B = 2
    (repeated thousands of times with small variations)

    File 2
    A = 1
    B = 4
    C = 3
    (repeated thousands of times with small variations)

    I want to say "Take all the B values from the left, and move them to the right", and then "Take all the C values from the right, and move them over to the left". Today with BC, that doesn't appear to be possible. Even worse, BC sees the changes to B and C as one single "change". So I have the possibility of taking everything from the left, or everything from the right, but I want a combination of those things. So this gets extremely tedious - for every change (and there are thousands of them), I have to say "Copy line to right" and "Copy line to left". Would be great if there was an easier way to do this.

  • #2
    There are ways to do what you are wanting to do. One way would be to create grammar elements for each type of data element (A values, B values, and C values). You can then set B values as important, A and C values as unimportant, enable the "Ignore Unimportant Differences" toggle, then filter on Left Orphans and copy them all to the right. Next set B values as unimportant and C values as important, then filter on Right Orphans and copy them to the Left.

    Other settings you may or may not want to tweak:
    Tools > Customize Commands... > Display filter presets: Toggles
    Session > Session Settings... > Alignment tab > Never align differences
    BC v4.0.7 build 19761
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

    Comment


    • #3
      Perhaps you had something else in mind since you referenced search/replace functionality in your post.
      BC v4.0.7 build 19761
      ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

      Comment


      • #4
        Hello,

        First, you will want to go to the Tools menu -> File Format, and for this File Format, go to the Misc tab and mark Lines are Independent. This will make the lines individual differences rather than sections.

        Next, if C is something you do not want to copy, I recommend making it Unimportant to this comparison. Define a grammar element to define C = \d* (where \d* is a Regular expression expressing any number of digits). This will show all C = differences as blue instead of red.
        Then toggle on Ignore Unimportant Differences in the toolbar to hide blue text as black. Then Show Differences will only show the differences you are concerned with copying. This should make copying your differences easy.
        http://www.scootersoftware.com/suppo..._unimportantv3


        Toggling Ignore Unimportant Differences will show the other, less important differences

        Since the Importance is a session setting, you can set it globally for all sessions (so C = is always blue) or only for specific comparisons (so C = is sometimes blue).

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

        Comment

        Working...
        X