Multi rename: how to Regex change to Upper/Lowercase?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
arbacia
New Member
New Member
Posts: 1
Joined: 2013-10-16, 23:47 UTC

Multi rename: how to Regex change to Upper/Lowercase?

Post by *arbacia »

I am trying to rename a lot of files using Multi-Rename Tool and regex. I want to change some parts of the filename to lowercase.

Example:
  • I want Aaa - 1993 - Bbb Ccc to be Aaa - 1993 - Bbb ccc
Search for:

Code: Select all

(.+) (.+)
Replace with:

Code: Select all

$1 $2
How I can set $2 to be lower case? Is it possible to set some of the matches to lower/uppercase individually? Similar to [N] or [L][N] but to individual regex matches. Something like [L]$2 doesn't work :S

I hope I made myself clear LOL. Thanks!
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

The regex-case-syntax would be:

Changing case in the 'Replace' box of regular expressions rule
Special character          Description
\u                                Converts the next character to uppercase.
\l                                 Converts the next character to lowercase.
\U                                Converts all characters to uppercase.
\L                                Converts all characters to lowercase.


But that is not supported with TC.



You could use Siren Renamer, though:


Siren is a freeware file renaming program - portable, flexible, powerfully, with preview, perl regex, meta data extraction,...
No installation needed, unzip and run. Siren stores it settings into an INI-file, not in the Registry.
If it's looking tricky, it's easy to rename with Siren. Press the F1-key while you are in Siren to read more about.
Homepage: http://www.scarabee-software.net/en/siren.html (The older v2 is enough and only 400kB against 10MB for v3)

For a "use-with-TC" how-to see http://scarabee-software.net/forum/viewtopic.php?id=76



The expression for your issue would be

%b( s/(.+) (.+)/$1 \L$2/ ).%e

Explanation:
%b() > work on the base name
s/// > perl regex style
.%e > original extension


.
User avatar
white
Power Member
Power Member
Posts: 6014
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Search&Replace - Regex - Upper/Lowercase

Post by *white »

arbacia wrote:I want to change some parts of the filename to lowercase.
....
Something like [L]$2 doesn't work :S
In the file name mask you can include both original name and name in lowercase. Then use regular expressions to get the right part from these strings.

Code: Select all

File name mask: [N]\[L][N][n]

Search for:   (.* ).*\\.* (.*)|\\.*
Replace with: $1$2

RegEx   checked

[E]     not checked
Subst   not checked 
Note:
Nowadays the multi rename tool can auto create folders and move files to sub folders, so it might be better to use a different character (or string) than "". That way, if you make a mistake, files will not be moved to sub folders.

Other examples:
Convert only parts of the filnames to uppercase
TC8.01 Multi-Rename Tool: Change First letter uppercase
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Post by *milo1012 »

Stefan2 wrote:The regex-case-syntax would be:

Changing case in the 'Replace' box of regular expressions rule
Special character          Description
\u                                Converts the next character to uppercase.
....
But that is not supported with TC.
....
This is not part of a Regular Expression scheme, it's program specific.
Even in Perl we'd have to use uc and lc.
RegEx is just about finding strings, but it's up to the program
how subgroups are referenced and if any other string manipulations are possible.

I agree with the solution from white, since you can't use any other special characters in the RegEx replace box than $<num>.
Post Reply