Concerning group capture (i.e., "add 12 to $1 PM"), the two strings BELOW 100% WORKS for "Replace with regular expression" (ONLY available via .MTA/Quick Action):
Field: DATE_TIME_BACKUP
Regular expression: (?<![\d])(0?[1-9]|1[0-1])(?![\d])(?=(?:[:]\d{1,2}){2}[\W_]*PM)
Replace matches with: $add($1,12)Field: DATE_TIME_BACKUP
Regular expression: (?<![\d])(0?[1-9]|1[0-2])((?:[:]\d{1,2}){2}[\W_]*)([AP]M)(?![\d])
Replace matches with: $if($eql($1,12),$if($eql($3,am),$sub($1,12),$1),$if($eql($3,am),$1,$add($1,12)))$2$3
However, the two strings, BELOW, 100% FAILS when using "$regexp(x,e,r,c)", regarding group capture (i.e., "add 12 to $1 PM"):
$regexp(%date_time_backup%,'(?<![\d])(0?[1-9]|1[0-1])(?![\d])(?=(?:[:]\d{1,2}){2}[\W_]*PM)',$add($1,12),1)
$regexp(%date_time_backup%,'(?<![\d])(0?[1-9]|1[0-2])((?:[:]\d{1,2}){2}[\W_]*)([AP]M)(?![\d])',$if($eql($1,12),$if($eql($3,am),$sub($1,12),$1),$if($eql($3,am),$1,$add($1,12)))$2$3,1)
I was wondering, when searching (?<![\d])(0?[1-9]|1[0-1])(?![\d])(?=(?:[:]\d{1,2}){2}[\W_]*PM), why does the group replacement, $add($1,12), FAIL when I use $regexp(x,e,r,c), but 100% WORKS when I use Replace with regular expression? Moreover, if I use Replace with regular expression and search for (?<![\d])(0?[1-9]|1[0-2])((?:[:]\d{1,2}){2}[\W_]*)([AP]M)(?![\d]), the Replace with regular expression allows me to replace with "$if($eql($1,12),$if($eql($3,am),$sub($1,12),$1),$if($eql($3,am),$1,$add($1,12)))$2$3". Basically, concerning the use of $regexp(x,e,r,c), my problem is why does the string, $regexp(%date_time_backup%,'(?<![\d])(0?[1-9]|1[0-1])(?![\d])(?=(?:[:]\d{1,2}){2}[\W_]*PM)',$add($1,12),1) FAIL to add 12 to $1 PM? Nevertheless, my only alternative was to use my 2022 string, $regexp(%date_time_backup%,'(?<![\d])(0?[1-9]|1[0-1])(?![\d])(?=(?:[:]\d{1,2}){2}[\W_]*PM)',$add($regexp(%date_time_backup%,'^.*(?<![\d])(0?[1-9]|1[0-1]):(\d{1,2}:\d{1,2})(?![\d]).*$',$1),12),1), for it to add 12 to PM"?
Therefore, I was wondering how can I make the scripting function $regexp(x,e,r,c) work the SAME way as Replace with regular expression? Is there something that I am missing on my end in order to replace with capturing groups with another scripting function, such as $add(x,y) ~ $add($1,12) when using $regexp(x,e,r,c)?