renameit icon indicating copy to clipboard operation
renameit copied to clipboard

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

Open w4hnsinn opened this issue 8 years ago • 1 comments

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

  • Note that this is NOT just a faulty preview, I have tried to actually run the rename like in the lower screenshot, and it fails with: ...problems have been detected.. invalid file name...contains forbidden characters...

  • I'm using v4 Alpha with the (highly appreciated) x64 context menu patch by Mr Pischedda

w4hnsinn avatar Jan 21 '17 16:01 w4hnsinn

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.

wernight avatar Jan 23 '17 09:01 wernight