Renaming simple - beyond me at the mo

A swapping-ground for Regular Expression syntax

Renaming simple - beyond me at the mo

Postby graniteartisan » Thu Jul 24, 2014 3:39 pm

All I want to do is rename a bunch of files and change the third character in each filename - nothing else. The filenames have consistent pattern in the first three letters. I want to change BBB001.jpg, BBB002.jpg and BBB003 48x12.jpg to BBM001.jpg, BBM002.jpg and BBM003 48x12.jpg. Simple. Yet somehow, the caffeine isn't enough today. Gingko maybe...
graniteartisan
 
Posts: 4
Joined: Fri Aug 16, 2013 8:21 pm

Re: Renaming simple - beyond me at the mo

Postby Stefan » Sat Jul 26, 2014 8:14 pm

That trick can be done with regular expression search-and-replace.

Rule:
- match first two sign and store it, skip third, match the rest and store it
- replace with what was matched first, enter your new sign, and what was matched as rest

FROM:
BBB001.jpg
BBB002.jpg
BBB003 48x12.jpg
TO:
BBM001.jpg
BBM002.jpg
BBM003 48x12.jpg

USE:
RegEx(1)
Search: (..).(.+)
Repla: \1M\2


.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Renaming simple - beyond me at the mo

Postby graniteartisan » Tue Aug 05, 2014 1:11 pm

Thank you! Worked like a charm!
graniteartisan
 
Posts: 4
Joined: Fri Aug 16, 2013 8:21 pm


Return to Regular Expressions