Versions Compared

Key

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

This function returns a text list with all substrings matching a given regular the result of a given Jira expression.

Code Block
languagebash
titleSyntax
linenumberstrue
findPatternjiraExpression(text, regex) #Output: Text list
UI Expand
titleExamples
code
Parser expressionDescription
Code Block
languagebash
linenumberstrue
%{findPattern("Between 1900 and 2000 world population increase from 1.5 to 6.1 billions.", "\d+(\.\d+)?")}

This example returns:

1900,2000,1.5,6.1



language
UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
text

Status
subtletrue
titletext

Any given text.
UI Expand
titleOutput

This function returns a 

Status
subtletrue
titletext
 

Extract all email addresses from a text field

Assuming %{issue.somefield} is a multi-line text fiel containing email addresses (added as hyperlinks), e.g.

Hello,

please use admin@example.com instead of administrator@example.com for future reference.

Kind regards,
jwt@example.com

this example returns:

admin@example.com,administrator@example.com,jwt@example.com

UI Text Box
sizemedium
typeinfo

Variant where you can additionally define a list of issues which can be used within the Jira expression given as the first parameter.

bash
linenumberstrue
%{findPattern(%{issue.somefield},"(?<=mailto:)([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)")}
Code Block
languagebash
titleSyntax
linenumberstrue
jiraExpression(text, issueList) #Output: Text list
UI Expand
titleExamples

Extract all user mentions from the last comment

Assuming %{issue.lastComment} returns, e.g.

Hi [~Alina Grant|~accountid:5c90f542efd65d2d3d465d7c]!

this example returns:

5c90f542efd65d2d3d465d7c%{findPattern(issue.lastComment},"([A-Z][A-Z0-9]+)-\d+")}

Extract all issue keys from the last comment

Assuming %{issue.lastComment} returns, e.g.

Hi [~admin],

this issues seems to be related to DEMO-1 and DEMO-2! 

this DEMO-1,DEMO-2
Parser expressionDescription
%{findPattern(%{issue.lastComment},"(?<=\~accountid:).*?(?=\])")}
Code Block
languagebash
linenumberstrue
%{
}

This

example returns:

1900,2000,1.5,6.1

Code Block
languagebash
linenumberstrue
%{findPattern(%{issue.somefield},"(?<=\|http://|\|https://).*?(?=\])")}
The current user %{issue.currentUser.displayName} has written %{jiraExpression("issue.comments.filter(c=>c.author.accountId==user.accountId).length")} comments to this issue and created %{jiraExpression("issue.subtasks.filter(s=>s.reporter.accountId==user.accountId).length} sub-tasks.

The current user John Doe has written 3 comments to this issue and created 2 sub-tasks.

Extract all URLs from a text field

Assuming %{issue.somefield} returns, e.g.

The best documentation can be found at [apps.decadis.net|https://apps.decadis.net]. Make sure to check the space for [Jira Workflow Toolbox|https://apps.decadis.net/display/JWT]! If you can't find what you're looking for there, all you have left is [Google|https://www.google.com].

this example returns:

apps.decadis.net,apps.decadis.net/display/JWT,www.google.com


This function returns a 

UI Expand
titleAdditional informationOutput

Parameters used in this function

ParameterInput (data type)Description
text

Status
subtletrue
titletext list

Any given text.regex Statussubtle

 

Page properties
hiddentrue
titletext

A valid regular expression that grabs all substrings to be returned.

UI Expand
titleOutput
Short description

Returns the result of a Jira expression.

Output
This function returns a
Code Block
languagebash
linenumberstrue
findPattern("Grass is Green and Sky is Blue.", "red|green|blue")
[ ] Page properties
hiddentrue
Output
Short description

Returns all substrings matching a given regular expression.

Status
subtletrue
titletext

list UI Text Box
typetip

If you want to ignore the case, have a look at the findPatternIgnoreCase() function.

Parser expressionOutput
Code Block
languagebash
linenumberstrue
findPatternIgnoreCase("Grass is Green and Sky is Blue.", "red|green|blue")
["Green", "Blue"]

 

Status
subtletrue
titletext list