No announcement yet.

Align Override to ignore middle of filename

  • Filter
  • Time
  • Show
Clear All
new posts

  • Align Override to ignore middle of filename

    I'm struggling with the regex for an alignment override on a folder compare.

    I would like: =
    applicationContext-dev.xml = applicationContext-uat.xml

    I can almost get it to work using:

    Left: ^(.+?)(-dev)(.+?)$
    Right: $1$3
    Regular expressions checked.

    With that I can match: =

    But I don't know hot to exclude "-uat" on the right side.
    (or allow it to match in the righ-hand result)

    I tried right: $1(-uat)$3
    but it doesn't seem to match anything.

    Any suggestions?

  • #2
    Thanks for writing in. Getting these defined can be a bit tricky, but how about:


    That seems to work with your two example file names.
    Aaron P Scooter Software


    • #3
      Thanks for the quick reply,
      that helped me see things a bit more clearly...

      I actually have multiple environments: local, dev, uat, prod, etc...
      And I want to be able to compare any two.

      I was trying to accomplish it with only 1 rule and cut '-uat' from the right side so it would match any environment. I see why having the ( ) caused nothing to match.

      So it looks like I need to have 1 rule per environment.
      (thankfully I have a limited set of environments)

      This is what I did...

      Left is the same for every rule,
      then cloned once for each environment to define the right:

      Left: (.+)(-local|-dev|-uat|-prod)(.+)

      Right: $1-local$3
      Right: $1-dev$3
      Right: $1-uat$3
      Right: $1-prod$3

      If there is a way to do it with a single rule, plese let me know.
      But otherwise this is working out great!



      • #4
        Not as a single rule, but you could set these rules up in on the Home screen, in the Edit session defaults folder, select Folder Compare, and they can be part of the global defaults for all future folder compare sessions. You then do not need to set them up each time, and can delete them if they are not to be applied in a New Session.
        Aaron P Scooter Software