Simple RegEx Bug?

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Simple RegEx Bug?

Postby therube » Tue Sep 29, 2020 7:22 pm

Simple RegEx Bug?

Am I understanding correctly?

Code: Select all
Match:  %1_%2_%3_%4_%5_%6
Replace:  %1


Results:
Code: Select all
SystemcontextUserInfo2020_07_04_06_15_28.txt ->
   SystemcontextUserInfo2020.txt
mouse_side_button_2_clicked_middle_skipped.png ->
   mouse_side.png
mouse_side_button_2_success_middle_skipped.png ->
   mouse_side.png
MemorizeinfoNew_2020_09_05_15_21_59.txt ->
   MemorizeinfoNew_2020.txt


Why not?
Code: Select all
   SystemcontextUserInfo2020.txt
   mouse.png
   mouse.png
   MemorizeinfoNew.txt


Is it going right-to-left, where only the first item has 6 "fields", where the others have 7, so it is skipping the first 5 & simply taking everything after that as the 6th, as, %1 ?
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Simple RegEx Bug?

Postby Admin » Wed Sep 30, 2020 1:36 am

Yes, this is something we want to look at indeed and probably change ... right now it behaves always in 'greedy' mode, but lazy would be more intuitive.

Code: Select all
'Greedy' means match the longest possible string.
'Lazy' means match the shortest possible string.
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm


Return to BRU Support