Regular expressions - picture names

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
mpurcarea
New Member
New Member
Posts: 1
Joined: 2004-03-01, 10:55 UTC

Regular expressions - picture names

Post by *mpurcarea »

Hy,

I want to use Multiple rename tool to rename pictures from say image-1.jpg .. image-17.jpg to image-01.jpg .. image-17.jpg for natural sequencing in TC or image viewer. Does anyone know what regular expression to use (or any other method)? For instance I've tryed to use Search for: (\d{2}) and Replace with: 0$1 for prefixing groups of 2 digits with one 0 but the 3 digit groups are modified too. Any suggestions?

10x. Mihai
WalkerBoh
Junior Member
Junior Member
Posts: 14
Joined: 2003-12-12, 13:29 UTC

Post by *WalkerBoh »

Just include the Characters in front and after the numbers into your regular expression. Thus:
Search for: -(\d{2})\.
Replace with: -0$1\.
User avatar
pdavit
Power Member
Power Member
Posts: 1529
Joined: 2003-02-05, 21:41 UTC
Location: Kavala -> Greece -> Europe -> Earth -> Solar System -> Milky Way -> Space
Contact:

Post by *pdavit »

You can actually work it out in the current situation without regular expressions. Just select only the files with the one-digit names then fill in the search field "-" and replace with "-0". (without of course the double-quotes)
"My only reason for still using M$ Window$ as an OS is the existence of Total Commander!"
Christian Ghisler Rules!!!
User avatar
Hacker
Moderator
Moderator
Posts: 13142
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

mpurcarea,
natural sequencing in TC
BTW: Try SortUpper=2 in wincmd.ini.

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
IGL
Member
Member
Posts: 179
Joined: 2004-02-26, 10:47 UTC
Location: Poland

Post by *IGL »

Someone may come across the case where after filename there are numbers without any separator. Then replace (with RegEx):
(\d{1,})\. into -$1\. to add "-" before digits
And then use
-(\d{1})\. into -0$1\. to rename one digit into two digits
or -(\d{2})\. into -0$1\. to rename two digit number into three
:-)
IGL
Member
Member
Posts: 179
Joined: 2004-02-26, 10:47 UTC
Location: Poland

Post by *IGL »

2Hacker - Thnx, YES! adding SortUpper=2 to wincmd.ini, section [Configuration] helps.
:-)
Post Reply