I am trying to clean public company names by removing certain character patterns from the end of the name. Sometimes a company will look like this: Some-Random Company Incorporated Inc. I get rid of special characters and and instances of Inc and Incorporated that appear at the end of the name:
MDS_DB.mdq.RegexReplace(MDS_DB.mdq.RegexReplace(COMPANY,
'[^a-zA-Z0-9 ]', '', 1), 'incorporated$|inc$', '',
mds_db.mdq.RegexMask(0, 0, 1, 0, 0, 0, 0))
Notice that this is already a nested function, and it works correctly resulting in:
SomeRandom Company Incorporated
Now I want to run the same replacement again to remove the Incorporated that is now at the end of the name due to the prior replacement:
MDS_DB.mdq.RegexReplace(MDS_DB.mdq.RegexReplace(MDS_DB.mdq.RegexReplace(COMPANY, '[^a-zA-Z0-9 ]', '', 1), 'incorporated$|inc$', '', mds_db.mdq.RegexMask(0, 0, 1, 0, 0, 0, 0)) ,'incorporated$|inc$', '', mds_db.mdq.RegexMask(0, 0, 1, 0, 0, 0, 0))
This does not have the expected effect, and the name remains the same:
SomeRandom Company Incorporated
Why aren't the nested replaces working in this case?