LiveAgent can automatically search for a string pattern in various text messages and replace it with something else before being displayed. The plugin works with messages like customer messages in chats, incoming messages from emails and contact forms, email answers from agents, ticket subject and notes. The plugin can be used for obfuscating sensitive information like credit card numbers, social security numbers and such.

Search & Replace Setup

Step 1: Navigate to Configuration>System>Plugins

Step 2: Find Search & Replace plugin in the list and click Activate

Step 3: Click Configure and define each rule on a separate line in format [regular expression to search for]==>>[replacement string].

Please use free online regular expression tester like regex101.com or regexpal.com to test your expressions. Use regular expressions without delimiters and modifiers. You can use $1, $2 etc. in replacement string to reference captured groups.

 

Examples

To obfuscate 16 digit credit card number you can use:

  • ([0-9]{4})[0-9]{8}([0-9]{4})==>>$1xxxxxxxx$2

This will match a string like  4111111111111111 and change it to 4111xxxxxxxx1111

  • ([0-9]{4})[- ]?[0-9]{4}[- ]?[0-9]{4}[- ]?([0-9]{4})==>>$1xxxxxxxx$2

This will match any of the following string and change it to 4111xxxxxxxx1111

4111111111111111
4111-1111-1111-1111
4111 1111 1111 1111

To obfuscate social security number:

  • [0-9]{3}-[0-9]{2}-([0-9]{4})==>>###-##-$1

This will match a string like  123-45-6789 and change it to ###-##-6789

 

×