Automate

Automate

Make your phone or tablet smarter with automation

Get it on Google Play

replaceAll

text replaceAll(text, regex, replacement)

Replaces each substring in text that matches the regular expression with the given replacement.

The replacement text may contain $1..$N references to capture groups declared within the regular expression.

Both the regular expression syntax and text literals use the backslash \ and left curly bracket { characters for special purpose. Use \\ and \{ to avoid the text literal interpretation.

Flags embedded as a prefix in regex:

FlagDescription
(?d)Unix lines mode
(?i)Case-insensitive matching (US-ASCII only)
(?iu)Case-insensitive matching (Unicode, preferred)
(?m)Multiline mode
(?s)Dotall mode, use it when matching a multiple line value
(?u)Unicode-aware case folding
(?x)Ignore whitespace and comments in pattern

Parameters

  1. text — text to be matched.
  2. regexregular expression to match against.
  3. replacement — optional replacement text, default is no replacement.

Returns

  • the text with substrings replaced.
Note! This documentation can also be found in the Help & feedback menu of the app.