Page 1 of 1

Replace all after first 4 characters (digits)

PostPosted: Fri Aug 27, 2021 11:01 am
by Mightyracoon
Any help appreciated in advance

Renaming a LOAD of files where the majority start with a unique 4-digit code (format 0000), followed by metadata jargon.

I'm looking to replace all of the jargon with "_ep_img" so the final format I'm looking for will be "0123_ep_img", minus quotation marks of course.

I've played around with the Remove (5) option; I attempted to use "Crop After 4", but that didn't seem to do the trick.

Anywhere obvious I'm going wrong with this? Happy to read on it :)

Re: Replace all after first 4 characters (digits)

PostPosted: Fri Aug 27, 2021 11:23 am
by Luuk
Remove(5) would need 'From'=='5' and 'To'=='999' to keep only the 1st-four characters, so then using Add(7) for a suffix.

But if all of your names dont start with 4-numbers, then instead I would use the RegEx(1) with a 'Match' and 'Replace' like...
^(\d{4}).+
\1_ep_img

Re: Replace all after first 4 characters (digits)

PostPosted: Fri Aug 27, 2021 11:26 am
by Mightyracoon
Luuk wrote:Remove(5) would need 'From'=='5' and 'To'=='999' to keep only the 1st-four characters, so then using Add(7) for a suffix.

But if all of your names dont start with 4-numbers, then instead I would use the RegEx(1) with a 'Match' and 'Replace' like...
^(\d{4}).+
\1_ep_img


Thank you so much!

The Remove/Add works now, I was missing the "To" entry like an idiot.

I'll have a look at the RegEx if I find that they're getting sloppy with putting the number at the front but so far, so good.

Thanks again mate!