The Search & Replace feature is a tool designed to automatically anonymize sensitive information in tickets. It works by searching for specific string patterns in tickets and replacing them with placeholders before they are stored and displayed. This feature is useful for sanitizing sensitive data such as credit card numbers, identification numbers, or even offensive language.
The plugin works by examining messages sent by users via chats, emails, contact forms, or the customer portal, as well as responses from agents, and optionally, notes. Furthermore, it provides an option to store the replaced original data in a custom ticket field.
Activating and setting up the plugin
To set up the feature and to define the rules by which the system would replace matched strings, first it is required to activate the "Search & Replace plugin" in Configuration > System > Plugins.
After activation, click on the Configure (pencil icon) button to set up the plugin and define the replacing rules, with each rule added on a new line.
Defining the replacing rules
Replacing rules guide the system in identifying the data to be searched and the replacement placeholder. This requires defining the regular expression (without delimiters and modifiers) which the system should search for, and the replacement, in the following format:
[regular expression to search for]==>>[replacement placeholder]
The feature also allows storing the original string in a custom ticket field after replacing the matched string. To configure the plugin in this way, enter the replacing rule in the following format:
[regular expression to search for]==>>[replacement placeholder]==>>[custom ticket field code]
Feel free to use AI to generate suitable regular expressions, and online regular expression testing tools such as regex101.com or regexpal.com to test your expressions.
In your replacement string, you can use $1, $2, etc., to reference the ( ) content captured groups.
| Replacing rules examples | ||
|---|---|---|
| Replacing rule | Description | Matched strings |
| ([0-9]{4})[- ]?[0-9]{4}[- ]?[0-9]{4}[- ]?([0-9]{4})==>>$1-xxxx-xxxx-$2 | Search for 16-digit credit card number pattern and replace the 8 digits in the middle with "x" | 1234-1234-1234-1234 → 1234-xxxx-xxxx-1234 1234 1234 1234 1234 → 1234-xxxx-xxxx-1234 1234123412341234 → 1234-xxxx-xxxx-1234 |
| [0-9]{3}-[0-9]{2}-([0-9]{4})==>>###-##-$1==>>account_id | Search for 9-digit number pattern in this format XXX-XX-XXXX, replace the first two groups of digits with "#", and write the original number into a custom ticket field with code "account_id" | 123-45-6789 → ###-##-6789 |
| dead==>>passed away | Search exactly for word "dead" and replace it with "passed away" | dead → passed away |
| fuck\w*==>>NASTY WORD | Search for word "fuck" or any variation of it and replace it with "NASTY WORD" | fuck → NASTY WORD fuck you → NASTY WORD you fucker → NASTY WORD |