wernight / renameit

Rename-It! is a Windows software to safely rename of thousands of files and folders at once via regex and all kind of other renaming filters. See the wiki section for more details.
http://www.beroux.com/english/softwares/renameit/
Apache License 2.0
106 stars 19 forks source link

[x] RegExp and [x] Change Case mess up, except if: [x] Replace once #42

Open w4hnsinn opened 7 years ago

w4hnsinn commented 7 years ago

Much like in previous versions or Rename-It, RegExp will usually (=with most regexp) not work as intended or at all, unless "Replace once" is checked as well.

I've seen this with several different types of Regular Expressions, this is just one example:

I was trying to simulate the "Word Case" replacement (because that one's broken too, see issue: #41 ) by means of RegExp.

Specifically, I was matching lower-case letters preceded by a space character: " ([a-z])" ..and trying to replace them with " \1" ..while having enabled the option: Change Case: UPPERCASE

As it turns out, this only works if the option "Replace Once" is also enabled. See screenshot for clarification, upper is with "Replace Once" enabled, lower without. Observe the preview field: http://i.imgur.com/35WLgNr.jpg

wernight commented 7 years ago

Nice bug report. It looks like the REGEX engine is built for ascii and giving ascii characters instead of unicode ones. The code is a big hack in the end so it might be from there. It's at https://github.com/wernight/renameit/blob/master/apps/Rename-It!/src/IO/Renaming/Filter/SearchReplaceFilter.cpp#L139 and using CString.MakeLower or MakeUpper.