Skip to main content

Replacing Whole Words Only using @replace

Hi All!
 
I'm trying to use @ replace to clean up a big Vendor Liost by replacing some common Company Names with "" (essentially removing the bits I don't want).
 
When I use Add Virtual Charachter and the parameters below, it removes parts of words, as well as whole words. How can I tell IDEA to replace Whole Words Only?
 
@replace(@replace(@replace(@replace(SUP_NAME, "CO", "" ),"AS", "" ),"AGENCY" ,  "" ),"AGENCIES" , "" ) 
 
In this example above "DALLAS COUNTY AUDITOR" becomes "DALL UNTY AUDITOR"
 

scotchy33 Wed, 03/29/2023 - 17:45

Use spaces or regular expression (@RegExpr).

@replace(@replace(@replace(@replace(SUP_NAME, " CO ", "" )," AS ", "" )," AGENCY" ,  "" )," AGENCIES" , "" )