RegexReplace Function

  • Updated

Replaces all occurrences of a Regular Expression pattern with a string.

Syntax 1

 

Replaces all occurrences of a Regular Expression pattern with a string.

 

RegexReplace(string, searchPattern, replaceValue)

 

 

Arguments:

 

 

 

string

String - A string.

 

 

searchPattern

String - A regular expression pattern to search for.

 

 

replaceValue

String - A string to replace all matches of pattern.

Syntax 2

 

Replaces all occurrences of a Regular Expression pattern with a string.

 

RegexReplace(string, searchPattern, replaceValue, caseSensitive)

 

 

Arguments:

 

 

 

string

String - A string.

 

 

searchPattern

String - A regular expression pattern to search for.

 

 

replaceValue

String - A string to replace all matches of pattern.

 

 

caseSensitive

Boolean - True to be case-sensitive in the regular expression pattern.

Remarks

  • The pattern may include a single group (), in which case the entire expression is matched while only the group is replaced.
  • Example: RegexReplace("Words, with punctuation!", "[^a-z0-9]", "") returns "Words, with".
  • Example: RegexReplace("words, with punctuation!", "[^a-z0-9]", "", true) returns "with".

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.