Check Date Syntax and Replace an Underscore

A swapping-ground for Regular Expression syntax

Check Date Syntax and Replace an Underscore

Postby Wayne__Wickson » Wed Jan 03, 2024 3:42 pm

Using these examples, the elements of the first date should be separated by underscores only. This would require a change in examples 2, 4, and 5.

Then, with the understanding that surnames are in "all caps", there needs to be a <space> immediately after each capitalized surname component. Surnames in parentheses are considered part of the surname component. This would require a change in examples 1, 2, 3, and 5.

This data will be exported as a CSV to Excel and further modified in that software. SPACES are critical as they become the delimiter between DATE - SURNAMES - GIVEN NAMES and DATE creating a four-column Excel sheet, once any page numbers at the end are eliminated.

Thanks in advance.

Wayne

1995_11_10 ROBERTSON(KILBURG)_Anne [2004_04_14_D_TR] 225.jpg

2002_06#20 POOLE_Albert_Edward_'Ted' [2002-06-21-D-TR].jpg

2002_06_17 ALEXANDER_Lorene_Lenora [2002-06-21-D-TR].jpg

1998-03_00 WYATT(WEBB) Luella 2004_12_17 215.jpg

1995-11_10 ROBERTSON(KILBURG)_Anne [2004_04_14_D_TR] 225.jpg
Wayne__Wickson
 
Posts: 2
Joined: Wed Jan 03, 2024 3:21 pm

Separate date elements with "_" and space after surname

Postby Luuk » Mon Jan 08, 2024 5:05 am

Without example new-names, Im guessing there is nothing else to change inside of the names?
To use "_" for Date1 elements and <space> for surnames, the "Match" and "Replace" can be like...
^((?:19|20)\d\d)[- _#](\d\d)[- _#](\d\d [A-Z]+(?:\([A-Z]+\))?)[- _#](.+)
\1_\2_\3 \4

If the is more separators to be replaced, must add them inside of [- _#here].
To only rename jpegs, RegEx(1) needs the checkmark inside for "Inc.Ext."
Then can add something like \.jpe?g$ to the very end of your "Match".

1995-11_10 ROBERTSON(KILBURG)_Anne [2004_04_14_D_TR] 225 ---> 1995_11_10 ROBERTSON(KILBURG) Anne [2004_04_14_D_TR] 225
1995_11_10 ROBERTSON(KILBURG)_Anne [2004_04_14_D_TR] 225 ---> 1995_11_10 ROBERTSON(KILBURG) Anne [2004_04_14_D_TR] 225
1998-03_00 WYATT(WEBB) Luella 2004_12_17 215 ----------------------> 1998_03_00 WYATT(WEBB) Luella 2004_12_17 215
2002_06_17 ALEXANDER_Lorene_Lenora [2002-06-21-D-TR] -----------> 2002_06_17 ALEXANDER Lorene_Lenora [2002-06-21-D-TR]
2002_06#20 POOLE_Albert_Edward_'Ted' [2002-06-21-D-TR] -----------> 2002_06_20 POOLE Albert_Edward_'Ted' [2002-06-21-D-TR]
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm


Return to Regular Expressions