Look Backward

Advanced Renamer forum
#1 : 05/05-24 21:00
Wayne Wickson
Posts: 5
Another folder ... another problem ...

2012_11_24 REID Robert_Andrew_'Bob'2_11_29.JPG"
2012_11_26 POTTS Francis_John_'Frank'2_11_29.JPG"
2012_11_27 GRILLS(MITCHELL) Leila_Margaret2_12_06.JPG"
2012_11_28 TEMPLETON Tammy_Ellen_N2_12_06.JPG"

Another folder contained several (hundreds) of filenames that lost some characters in the middle. Specifically, the [space]201 that formed part of the second pseudo date in each example above got chopped out leaving a character against the remaining number. [' against 2] [k against 2] [t against 2] [N against 2]

I need to select the 2 in each case to replace it with a [space]201 to correct the date format.

I can normally do that with a "lookbehind" REGEX expression but that does not work in Advanced Renamer.

Is the syntax different for Advanced Renamer?

=============================

Some of these filenames also need an underscore replaced by a [space]. In each of these cases, the underscore is preceded by a word in upper case letters or by a ")".

2012_05_16 BERTRAM_Iona_Bessie 2012_05_21
2012_07_21 SMITH(JONES)_William 2012_07_25

Is there an expression that would "universally" select a specific character?

#2 : 06/05-24 02:33
Delta Foxtrot
Posts: 364
Reply to #1:

Hi Wayne,

Man, what are you guys smokin' up there in the frozen north??? LOL, sorry...

Both problems are relatively simple, but my question is, do you have any "front" date years that are a different decade from "back" date years? Something like

2009_12_27 REID Robert_Andrew_'Bob'0_01_05.jpg ->
2009_12_27 REID Robert_Andrew_'Bob' 2000_01_05.jpg

springs to mind. You didn't mention it so I'm not going to worry about it. Any more. :)

You don't need lookbehind for this, and you're right, ARen doesn't support that; you just need backreferencing. For what you described, either of these will work:

Replace:
TTBR: <Substr:1:3>(.*)<Rsubstr:1:7>
RW: <Substr:1:3>$1 <Substr:1:3><Rsubstr:1:7>
Regex: Yes
-or-
TTBR: ^(\d{3})(.*)(.{7})$
RW: $1$2 $1$3
Regex: Yes
(the only spaces are of course interior to the replace strings)

The second problem can be fixed easily enough, although your example confuses me. Are the full date years already in the filenames? I guess it doesn't really matter; another replace method, all by itself in a separate batch, with:

TTBR: ([A-Z\)])_
RW: "$1 "
(without the quotes, of course, in the "Replace with:" string; they are just to illuminate the space following $1)
Case sens: YES
Regex: YES
Apply to: Name

If the filenames already have the full year in the second date don't have the previous replace(s) active. If the dates are truncated as in problem one you can do the whole thing in one pass with two methods. Although this replace might work for all, I'm getting cross-eyed looking at regex patterns and wonky filenames so I won't swear to it. :) Just have backups this time!

REPLACE:
TTBR: ^(\d{3})(.*)([A-Z\)])_| (.*)(.{7})$
RW: $1$2$3 $4 $1$5
Case sens: YES
Regex: YES
Apply to: Name

Hope that helps. When I read it back I got confused. :)

Best,
DF
#3 : 06/05-24 06:31
Wayne Wickson
Posts: 5
Thanks for all your help.

I'm coordinating a volunteer project for a non-profit, a genealogy society. We are "cleaning" up these filenames that relate to obituaries in a project that had many contributors with "different styles", shall we say.

The first date is the "date of death" and the second date in each record is the date the obituary was "published" in a specific newspaper.

These records are very contemporary compared to some we will be working with eventually. :-)

Thanks again.

Forum "Admins", like yourself, are who add real value to these platforms.

Wayne
#4 : 06/05-24 07:38
Delta Foxtrot
Posts: 364
Reply to #3:

Not any kind of admin, just an old, tired Texas cowboy that likes to see people happy. And likes Advanced Renamer. :)

Works out well, I think.

Best regards,
DF
#5 : 06/05-24 16:25
Miguel
Posts: 163
Reply to #1:
I think that Delta Foxtrot give you the solution in your previous post:
https://www.advancedrenamer.com/forum_thread?for um_id=14436

Replace: ^([^ ]+)([^\d]+)
Replace for: $1$2 201

Miguel