Announcement

Collapse
No announcement yet.

Compare files with regular expression

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

  • Compare files with regular expression

    Hi,

    I'm having a problem comparing files in two different folders which do not have the exact same names (using BC4 Pro).
    For example on the left side the files are like:

    abcD1efg_aaa.txt
    abcD1efg_bbb.txt
    abcD1efg_ccc.txt
    etc.

    And on the right side the files look like:

    abcZ2efg_aaa.txt
    abcZ2efg_bbb.txt
    abcZ2efg_ccc.txt
    etc.

    I believe this case can be easily aligned with regular expression (as only the D1 and Z2 parts are different in the file names) but for some reason the alignment does not work.

    Could someone suggest the regular expression which will work for this case?

    Thanks a lot in advance.

  • #2
    Hello,

    BC4 Pro's feature in the Folder Compare's Session menu -> Session Settings, Misc tab: Alignment Overrides may be able to help. If your change is static, you could define something like
    (.*)D1(.*).txt
    =
    $1Z2$2.txt
    with regular expression enabled.

    The trick to the definition is that the right side only supports Tagged expressions (see the dropdown menu next to the textbox) so different text (Z2) must be explicitly defined in the With/Right side.

    As a tip: I'll start by selecting a left file, right-click -> Align With, and then select it's target. This auto-populates that very specific rule in the Alignment Override section. You can then slowly build the reg ex to replace parts of the filename at a time, verifying it works, until you have the full regex.
    Aaron P Scooter Software

    Comment


    • #3
      Thanks a lot for the great suggestion.
      That worked!

      Comment

      Working...
      X