Alignment override again

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mareas
    New User
    • Sep 2016
    • 2

    Alignment override again

    Hi,

    I've searched the forum quite intensively, but I cannot find a solution for my specific problem.

    I want to compare the file name like H-1013_BP1_0001.jpg with H-1013_1.jpg or H-1013.jpg.

    Basically I want to override everything after the underscore. Everything else, (time stamp, size, folder,...) is supposed to be ignored.

    I've tried (.*)_\w\d.*\.jpg =$1.jpg and a few other variations I adapted from forum posts, but I did not find a working solution so far.

    Best regards

    M
  • Aaron
    Team Scooter
    • Oct 2007
    • 16002

    #2
    Hello,

    This is very close. The initial .* can be a bit greedy, so I would recommend using ^_ (not _) instead. Here's the RegEx I tried out:
    ([^_]+).*\.jpg = $1.jpg

    For matching on H-1013_1.jpg, you would need to add that to the destination explicitly:
    ([^_]+).*\.jpg = $1_1.jpg
    Aaron P Scooter Software

    Comment

    • Mareas
      New User
      • Sep 2016
      • 2

      #3
      Thank you! That worked like a charm!

      Comment

      Working...