Search a field, use a regular expression to find data, and replace with desired string. For use only on text fields.
RegExReplace(InputString, RegularExpression, ReplaceString)
Knowledge of regular expressions IS REQUIRED to use this formula and customers are responsible for building their own expressions.
Example 1: Replace a carriage return in a street address with a space
RegExReplace({billingstreet},"\n"," ")
- Input: 55 Best Place
Suite 12 - Result: 55 Best Place Suite 12
Salesforce appears to strip out carriage returns (\r) and only stores line feed characters (\n) so when you see data on a new line you will need to use the \n to find/replace the new line character.
Example 2: Replace a dash with space dash space
RegExReplace({name}, "([0-9A-z])-([0-9A-z])", "$1 - $2")
- Input: Validity-Inc.
- Result: Validity - Inc.
Note: DemandTools uses .Net's regex engine.
Click HERE to return to the full list of MassImpact Formulas.