Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
UI Text Box
sizemedium
typeinfo

This function replaces all substrings matching the given regular expression with a given replacement.

Code Block
languagebash
titleSyntax
linenumberstrue
replaceAll(text, regex, replacement) #Output: Text
UI Expand
titleExamples
Parser expressionDescription
Code Block
languagebash
linenumberstrue
%{replaceAll(" Hello World ", "\s", "")}

This example returns:

HelloWorld


Info

All whitespace characters have been removed. 

\s is the regular expression equivalent for a whitespace.

Code Block
languagebash
linenumberstrue
%{replaceAll(" He__o Wor_d ", "_", "l")}

This example returns:

Hello World

UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
text

Status
subtletrue
titletext

Any given text.
regex

Status
subtletrue
titletext

A valid regular expression that grabs all substrings to be replaced.
replacement

Status
subtletrue
titletext

This text will replace all substrings found by the given regex.
UI Expand
titleOutput

This function returns a

Status
subtletrue
titletext

UI Text Box
typetip

This expression could be used to e.g. modify an issue's summary or description.

UI Text Box
typetip

If you want to replace only the first matching occurrence, have a look at the replaceFirst() function.

Parser expressionValue
Code Block
languagebash
linenumberstrue
%{replaceFirst("Hello World", "l", "_")}
He_lo World
Code Block
languagebash
linenumberstrue
%{replaceAll("Hello World", "l", "_")}
He__o Wor_d


If you don't want to use a regular expression, have a look at the findReplaceAll() function.

Page properties
hiddentrue
Short description

Replaces all substrings matching a regular expression with a given replacement.

Output

Status
subtletrue
titletext