Remove repeating or duplicated name in image file

Post any general comments regarding Bulk Rename Utility here. Open to all registered users.

Remove repeating or duplicated name in image file

Postby jaki » Thu Aug 20, 2015 8:07 pm

Hi,

Alle repeating name in image file as:
144565-book-black-45845-black-545s45-2.jpg
144565-book-black-45845-black-545s45-2.jpg
165-book-black-5-black-545s45-2.jpg
5-book-black-45845-black-545s45-2.jpg
244565-book-black-45845-black-545s45-2.jpg
244565-book-black-45845-545s45-2-black.jpg
black-black-545645.jpg

How to remove "black" and keep only one of them? like as:

244565-book-45845-545s45-2-black.jpg
144565-book-45845-black-545s45-2.jpg

can somebody help me ?
jaki
 
Posts: 1
Joined: Thu Aug 20, 2015 7:49 pm

Re: Remove repeating or duplicated name in image file

Postby Stefan » Mon Oct 05, 2015 12:11 pm

Hi,

match (digits, hyphen, 'book' ,hyphen) --- any amount of chars --- (hyphen, digits, the rest)
replace with matching group \1 + \2


FROM:
144565-book-black-45845-black-545s45-2.jpg
TO:
144565-book-45845-black-545s45-2.jpg
TRY
RegEx(1)
Match: (\d+-book-)\w+(-\d+.+)
Repla: \1\2


NEXT...

FROM:
black-black-545645.jpg
TO:
black-545645.jpg
TRY
RegEx(1)
Match: (.+-)\1(\d+)
Repla: \1\2






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


Return to General Comments


cron