microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
111.18k stars 6.54k forks source link

PowerRename Regex skipping file that should be matched #31950

Open 04alband opened 7 months ago

04alband commented 7 months ago

Microsoft PowerToys version

0.79.0

Installation method

PowerToys auto-update

Running as admin

No

Area(s) with issue?

PowerRename

Steps to reproduce

See screenshots. I'm renaming a bunch of images to change and fix their sequence number. Some of the original files end with " (2)". You can see I have a wildcard in the regex to optionally match that. This works, except for the first file that doesn't have the " (2)". I tried the same regex on https://regex101.com/ with the EMCAScript flavor and it should match. image I tried manually renaming that file to remove the " (2)". After then, the next file became the issue - i.e. the file that was NOW the first one without the " (2)". image

✔️ Expected Behavior

All files matching the regex should be matched.

❌ Actual Behavior

See screenshots. The first file matching a different 'branch' of the regex is not matched.

Other Software

No response

crutkas commented 3 months ago

DSCF([\d]{4}).*.txt DSCF${padding=4,start=997}.txt

The first hit where the file is an exact match, it reproduces this.
image image

crutkas commented 3 months ago

I'm on 0.82, FYI for benchmarking

04alband commented 3 months ago

Thanks for responding. It's been a while since I used it like this so had to recreate the situation to test. As you show, it's to do with the start number. I filled a folder with images like DSCF0001 (2).JPG to DSCF0999 (2).JPG then DSCF1000.JPG to DSCF1959.JPG (just the number of them I have). My input (on 0.82 also btw) was then: DSCF([\d]{4}).*.JPG DSCF${padding=4,start=128}.JPG This worked as it should. If I then deleted the first 127 images, so my images are instead DSCF0128 (2).JPG to DSCF0999 (2).JPG then DSCF1000.JPG to DSCF1959.JPG, it then reproduces the bug.