Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


UI Text Box
sizemedium
typeinfo

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

Use this function instead of replaceAll() or replaceFirst() if you want to have full control over the exact substrings you want to replace.


Code Block
languagebash
titleSyntax
linenumberstrue
findModify(text, regex, replacement) #Output: Text


UI Expand
titleExamples
Page properties
hiddentrue
Status
Tech review

Status
titletodo

Style guide

Status
titletodo

Status
titletodo
Status
colourYellow
titleReady for review
Status
colourGreen
titledone
Status
colourRed
titleflagged

Page properties
hiddentrue
Short descriptionReturns a Statussubtletruetitlestring like s, but where all substrings matching regexp have been replaced with the result of evaluating replacement_expression against each of these substrings.Output Statussubtletruetitlestring


UI Text Box
sizemediumArgument text_expression is an expression that returns a string, where ^%
typeinfo
The function returns a Statussubtletruetitlestring like s, but where all substrings matching regexp have been replaced with the result of evaluating replacement_expression against each of these substrings.

^% represents each of the matching substrings, and ^ represents the order of appearance beginning with 1.


Parser expressionDescription


Code Block
languagebash
titleSyntax
linenumberstrue
findModify(
string s, string regexp, string replacement_expression) #Output: String UI Expand
titleExamples
Description
"JWT is the best tool!", "JWT", "Jira Workflow Toolbox") 


This example returns 

Jira Workflow Toolbox is the best tool!

Parser expression


Code Block
languagebash
linenumberstrue
findModify(string s, string regexp, string replacement_expression) 
The function returns a
Status
subtletrue
titlestring
"ThE curE for bOredOm is cUriOsity."
"The cure for boredom is curiosity", "[aeiou]", modulus(^, 2) = 1 ? toUpperCase(^%) : ^%) 


This example returns

ThE curE for bOredOm is cUriOsity.


UI Text Box
typeinfo

This example checks for vowels in the given text and writes them into a list.

The output will be e, u, e, o, o, e, o, i, u, i, o, i

For each appearance it checks whether the position is an odd number (modulus).

If the position is an odd number the character will be converted to upper case using the toUpperCase() function.

e - modulus(1,2) = 1 -> E will be upper case
u - modulus(2,2) = 0 -> U will be lower case
e - modulus(3,2) = 1 -> E will be upper case

...

Long story short: Every second vowel will be converted to upper case!




Parameter description
UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
<parameter>
text

Status
subtletrue
title

data type

text

Any given text.
<parameter>
regex

Status
subtletrue
title

data typeParameter description.<parameter>

text

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

Status
subtletrue
title

data typeParameter description

text

Any given text.



UI Expand
titleOutput

The This function returns a

Status
string
subtletrue
titleText



Image AddedUse cases and examples

Page properties report
firstcolumnUse case
headingsJWT feature, Workflow function, Field type, Automated action, Parser functions
cqllabel = "parser_func_findmodify" and space = currentSpace()


Page properties
hiddentrue
id1


Parser function cloud
Map(question)
Notes

Workaround

Code Block
languagebash
let desc = issue.description.plainText;
desc.replace("\badmin\b", "tester")





Page properties
hiddentrue



Status
Tech review

Status
colourGreen
titledone

Style guide

Status
colourGreen
titledone

Status
titletodo
Status
colourYellow
titleReady for review
Status
colourGreen
titledone
Status
colourRed
titleflagged



Page properties
hiddentrue


Short description

Replaces specific substrings matching a given regular expression.

Output

Status
subtletrue
titletext

Available since

Status
subtletrue
colourBlue
title2.2.12

Label