REPLACEREGEX

Syntax

REPLACEREGEX (string_to_search, search_regex, replacement_string)

Description

In string_to_search, replaces all strings that match the regular expression defined by search_regex with the replacement_string.

Arguments

string_to_search The string to modify.
search_regex A Microsoft-formatted regular expression.
replacement_string The string to replace each match for the search_regex regular expression.

Returns

The modified string_to_search.

Remarks

If search_regex is not found, REPLACEREGEX returns the original string_to_search.

For detailed information about using Regular Expressions, see the Microsoft .NET Regular Expression Language - Quick Reference.

Example

If Account.Address contains the value "1750 Elm St Manchester NH 03110"

REPLACEREGEX(account.address, "(^\d{5}$)|(^\d{5}-\d{4}$)", "03104")

Returns: 03104 in place of postal code "03110".

Related Topics

Text Functions

FINDREGEX

ISREGEXEXACTMATCH

MATCHREGEX

REPLACE