We have a Business scenario where the Source Data is getting populated as ‘FIRST FINANCIAL SECURITIES OF AMERICA I’ where ‘I’ is getting populated as suffix . We need to remove the character ‘I’ from suffix and derive the data as ‘FIRST FINANCIAL SECURITIES OF AMERICA’ but when we use the below code in the expression transformation it is removing the character ‘I’ for all occurrence and gives the following out put string ‘FRST FNANCAL SECURTES OF AMERCA’. Can anyone please help me out in achieving the above logic using REG_MATCH and REPLACESTR ?
**--parse suffix txt from last name**
IIF(REG_MATCH(LAST_NAME,'.*sIs.*') OR REG_MATCH(LAST_NAME,'.*sI'),REPLACESTR(1,LAST_NAME,'I',''),
IIF(REG_MATCH(LAST_NAME,'.*sIIs.*') OR REG_MATCH (LAST_NAME,'.*sII'),REPLACESTR(1,LAST_NAME,'II',''),
IIF(REG_MATCH(LAST_NAME,'.*sIIIs.*') OR REG_MATCH(LAST_NAME,'.*sIII'),REPLACESTR(1,LAST_NAME,'III',''),
IIF(REG_MATCH(LAST_NAME,'.*sIVs.*') OR REG_MATCH(LAST_NAME,'.*sIV'),REPLACESTR(1,LAST_NAME,'IV',''),
IIF(REG_MATCH(LAST_NAME,'.*sVs.*') OR REG_MATCH(LAST_NAME,'.*sV'),REPLACESTR(1,LAST_NAME,'V',''),
IIF(REG_MATCH(LAST_NAME,'.*sJRs.*') OR REG_MATCH(LAST_NAME,'.*sJR'),REPLACESTR(1,LAST_NAME,'JR',''),
IIF(REG_MATCH(LAST_NAME,'.*sJR.s.*') OR REG_MATCH(LAST_NAME,'.*sJR.'),REPLACESTR(1,LAST_NAME,'JR.',''),
IIF(REG_MATCH(LAST_NAME,'.*sSRs.*') OR REG_MATCH(LAST_NAME,'.*sSR'),REPLACESTR(1,LAST_NAME,'SR',''),
IIF(REG_MATCH(LAST_NAME,'.*sSR.s.*') OR REG_MATCH(LAST_NAME,'.*sSR.'),REPLACESTR(1,LAST_NAME,'SR.',''),
IIF(REG_MATCH(LAST_NAME,'.*s3RDs.*') OR REG_MATCH(LAST_NAME,'.*s3RD'),REPLACESTR(1,LAST_NAME,'3RD',''),
LAST_NAME))))))))))