replace

Modified on Wed, 02 Aug 2023

Description

Replace matches for pattern in a string with replacement.

Syntax

replace(input, find, replacement)

Parameters

Input ParameterTypeDescription
inputstringThe string to modify.
findstringThe pattern to replace.
replacementstringThe match replacement.

Return value

Type
string

Sample

ExampleResultDescription
replace('Hi Fred', 'Fred', 'Barney')'Hi Barney'Replace 'Fred' with 'Barney'
replace('Hi Fred Sr and Fred Jr !', 'Fred', 'Barney')'Hi Barney Sr and Barney Jr !'Replace all occurrences of'Fred' with 'Barney'

To view all the String functions, click here.