Choose where you’d like to start

replaceAll()

Overview

The replaceAll() function takes string , searchString , and replacementString as arguments. It replaces all occurrences of searchString with replacementString in the string, and returns the string.

If searchString is not present in the string, it will return the string as it is.

Note: This function performs a case-sensitive search.

Return Type

  • Text

Syntax

<variable> = <string>.replaceAll( <searchString>, <replacementString>, <boolean> );

(OR)

<variable> = replaceAll( <string>, <searchString>, <replacementString>, <boolean> );
ParameterDescriptionData type
<variable>Variable which will contain the returned string.TEXT
<string> The string in which all occurrences of searchString will be replaced with replacementString.TEXT
<searchString>


All occurrences of this searchString will be replaced with replacementString, in the string.

TEXT
<replacementString>


This replacementString will replace all occurrences of searchString in the string.

TEXT
<boolean>


Applicable values: true or false.

By default, the replaceAll() function supports regular expression (i.e) it will not find and replace the special characters like $ in the source string.

This parameter can be used to specify if the regular expression is to be supported or escaped.

  • The value true denotes escaping the regular expression.
  • The value false denotes supporting the regular expression. By default, the value is taken as "false".
BOOLEAN

Examples

mainString="Create online database applications";
newText = replaceAll(mainString, "online", "custom");             
// returns "Create custom database applications"

Get Started Now

Execute