Searches a string for a pattern and replaces it with a replacement string.

Usage

RegexpReplace(string, pattern, replacement)

string (required): The string to search.
pattern (required): The pattern to extract with.
replacement (required): String to replace the sought pattern.

When the regular expression you want to use contains a slash, quotation or other special character, you will need to use a backslash (\) to escape the special character. Regexp can vary based on the databases. Check the documentation of your database to find the correct syntax.

Example

RegexpReplace([Phone Number], "(\\d{3})(\\d{3})(\\d{4})", "(\\1) \\2-\\3")
  • Transforms a phone number to (xxx) xxx-xxxx formatting.

RegexpReplace([City], "^(.*?),", "San Francisco,")
  • Replaces every character before the comma with the city in proper form.

Output:

RegexpReplace([Team], "[^a-zA-Z0-9\\s]", "")
  • Removes all punctuation marks in a string.

Output:

RegexpReplace([Text], "\\/", "&")
  • Replaces the slash with "&".

Output:

Related Resources


Was this page helpful?
Yes No