This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
This is easily achieved using a RegEx formula. In a Formula tool use the following to replace the DOB cases:
REGEX_Replace([Field1],"DOB \<\w+\>","DOB This text has been removed")
The expression "DOB \<\w+\>" is identifying strings in [Field1] where "DOB " is followed by a string of characters. When that case is true, then "DOB " and the first subsequent string of characters will be replaced with "DOB This text has been removed".
Using the above formula on this input:
DOB 19000101 PLUS SOME ADDITIONAL TEXT
This is the result:
DOB This text has been removed PLUS SOME ADDITIONAL TEXT
DOB \<\w+\> isn't the only way this can be achieved, but the expression will depend on the format of the information following the keyword. If the string following the keyword is only numeric characters then "DOB \d+" could be used.
Just one other request using your solution... what would be the correct expression to find the Keyword from the lookup and place two special characters at the start and end of it (rather than replace the next string following the Keyword?
Adding the characters is easy, just add them in the replacement argument. Here's what the formula above would look like:
REGEX_Replace([Field1],"DOB \<\w+\>","%DOB This text has been removed%")
Solving the multiple keyword replacement took the solution in a different direction. To solve this, I built an iterative macro that loops through the list of keywords input and replaces all instances of that word in that iteration. The iterative macro solution is attached.