REG_REPLACE - Replace a string matched by regular expression pattern in Informatica

REG_REPLACE is a powerful function available in informatica, which replaces string recognized by regular expression with given replacement.

Example : Remove the first word in the regular expression
REG_REPLACE(Input,'\w+ ','',1)

InputOutput
Adam SandlerSandler
SanchezSanchez
Sam [Sam followed by white space]Empty String
St John AdamJohn Adam


Syntax :
REG_REPLACE( subject, pattern, replace, numReplacements )


ArgumentRequired/OptionalDescription
subjectRequired String datatype.Passes the string you want to search.
patternRequired String datatype.Passes the character string to be replaced. You must use perl compatible regular expression syntax. Enclose the pattern in single quotes.
replaceRequired String datatype.Passes the new character string. numReplacements Optional Numeric datatype. Specifies the number of occurrences you want to replace. If you omit this option, REG_REPLACE will replace all occurrences of the character string.