Page 1 of 1

Add Character X from end

PostPosted: Thu Feb 02, 2017 4:59 pm
by pi3
Hi
I’m probably being stupid, but I just can't work out how to do this.

say I've got 3 files (or hundreds) with a date added to the end, but the preceding number of characters are different.

i.e
56006_250716.jpg
3424233_250716.jpg
67465674_250716.jpg

And I want to inject a – between the dates 25-07-16.jpg

If I use Add (7) at pos. - the added char is in different places in each file as the count is from the start of the file, not the end.
How do you do this, as would think you’d need to count from the end of the filename, not the beginning.

Can this be done? Am i just missing the obvious (likley!)

Many thanks for any help

Pi3

Re: Add Character X from end

PostPosted: Thu Feb 02, 2017 6:51 pm
by therube
Is it always _date ?
If so, you could try...

1:RegEx
Code: Select all
Match:  ^(.*)_(\d\d)(\d\d)(\d\d)$
Replace:  \1_\2-\3-\4

Re: Add Character X from end

PostPosted: Fri Feb 03, 2017 11:39 am
by Emerkamp
Hi:

I think you can also enter negative values in the "at pos" box.

Re: Add Character X from end

PostPosted: Fri Feb 03, 2017 8:14 pm
by JMM
Certainly, you can enter negative values, and BRU interprets them as 'position N chars counting from the end of the name leftwards'. So inserting something at position -6 would do something like what you want to do.

Re: Add Character X from end

PostPosted: Sat Feb 04, 2017 3:51 pm
by pi3
Many thanks, that works.