Example 4: Converting .org domains to .com

Match string: (.*@acme\.)org

Replacement string: $1com

Input data: fred.bloggs@acme.org

Output data: fred.bloggs@acme.com

The match string .*@acme\. detects any address that contains the string @acme. and is preceded by 1 or more characters. The final full stop needs to be escaped (preceded by a backslash), to avoid being interpreted as any character.

The parentheses around this part of the match string ensure the string is placed in parameter 1. The final org in the match is outside the parentheses, hence it does not get placed in parameter 1. The replacement string contains the text com which is appended to the string matched by:

.*@acme\.