Changing ThisTypeOfFileName.ext to This Type Of FileName.ext
Hi folks, Can anyone perhaps help me with a Total Commander-compatible regular expression I can use in the multi-rename tool to change CamelCase filenames into Separate Word Filenames?
I've tried ([a-z])(A_Z) replacing with $1 $2 but it produces a very weird result, sticking spaces in all over the place. My regex-fu isn't very good and I hope someone else with a bit more savvy can give me a boost
This isn't a trivial task since you have to consider many "special" cases or restrict yourself to certain rules.
(what happens when there are two or more upper case letters following in a row,
do you also want to consider non-latin letters, what if whitespace is enclosed ...)
Well, try this:
If names always start with capital letter:
Search for: (?-i)([A-Z]{1})([^A-Z]*)
Replace with: $1$2_
(Replace _ with a space after $2 !)
If names start with non-capital-letter sign (anything except capital letter):
Search for: (?-i)([^A-Z]*)([A-Z]{1})
Replace with: $1 $2
(space between $1 and $2 !)
This should work for most cases except whitespace.
You'll get double whitespace in that case, but you should be able to delete the second one in another session quite easy.
AFAIK there's no way to handle both cases at once, i.e. name can start with capital letter and anything else without adding additional spaces.
If someone knows, feel free to add.