Regex rename - insert space between uppercase/lowercase

looking for help with a quick rename script.

i have about 30,000 files with names like this:
InspectorGadgetAndTheCircusOfFear.z80.zip
Kocka2004.z80.zip

i need them to be like this:
Inspector Gadget And The Circus Of Fear.z80.zip
Kocka 2004.z80.zip

basically, if there is a lowercase letter or a number followed by an uppercase letter, it should add a space between
but it should ignore the file extension (always follows the pattern .***.zip but the *** is not always z80)

thanks to anyone who has a moment to help!

(for the curious, these are tape/disc images of old Sinclair ZX Spectrum games from worldofspectrum.org. the guy who runs the site has obtained free distribution rights for the files from the relevant publishers)

Try those two commands from a Button:

Add Spaces before Uppercase Characters:Rename REGEXP PATTERN "(.*)(([^A-Z ])([A-Z]+))(.*)#" TO "\1\3 \4\5" MATCHCASE AUTORENAME

Add Spaces before and behind Numbers:Rename REGEXP PATTERN "(.*)(([^0-9 ])([0-9]+)|([0-9]+)([^0-9 ]))(.*)#" TO "\1\3\5 \4\6\7" AUTORENAME

thanks kundal, that more or less works for me :slight_smile:
i appreciate the reply!

The second one will not really satisfy your needs because it adds Spaces even if a dot follows a number.
It's not very useful to add Spaces before the file extension or if the number is e.g. a date separated by dots.

So your example "Kocka2004.z80.zip" will become "Kocka 2004 .z 80 .zip".

Perhaps someone here is able to modify it.

not to worry. i ran all the files through the first script and am tidying up the rest by hand, shouldn't take but an hour or two :slight_smile:

thanks again!

A little workaround for the second command:

Add Spaces before and behind Numbers (if not dots are present):Rename REGEXP PATTERN "(.*)(([^0-9 ])([0-9]+)|([0-9]+)([^0-9 ]))(.*)#" TO "\1\3\5 \4\6\7" AUTORENAME Rename FINDREP=ext PATTERN " ." TO "." Rename FINDREP=ext PATTERN ". " TO "."

With this your example "Kocka2004.z80.zip" will become "Kocka 2004.z 80.zip" which is nearly what you want to have except the Space between "z" and "80".
To delete this last Space you can use a Button that deletes a Character from a certain Position counted from the end of the filename.
You'll find this Button here:
[url]Remove characters from selected folder and file names]