This function returns a text list with all substrings matching a given regular expression.
Parser expression | Description |
---|---|
findPattern("Between 1900 and 2000 world population increase from 1.5 to 6.1 billions.", "\\d+(\\.\\d+)?") | This example returns the following text list: ["1900", "2000", "1.5", "6.1"] |
findPattern(%{issue.somefield},"(?<=CN=).*?(?=,OU=Users)") | Assuming
this example returns the following text list: ["User1", "User2", "User3", "User4"] |
Extract all email addresses from a text field findPattern(%{issue.somefield},"([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.[a-zA-Z0-9_-]+)") | Assuming
this example returns the following text list: ["admin@example.com", "administrator@example.com", "jwt@example.com"] |
Processing an Elements Connect (formerly nFeed)* custom field findPattern(%{issue.somefield},"(?<=:\\[\"|\",\").*?(?=\")") * Applicable for Elements Connect version 6 and above. | Assuming { "keys":[ "KEY-1", "KEY-2", "KEY-3" ] } this example returns the following text list: ["KEY-1", "KEY-2", "KEY-3"] |
Extract all user mentions from the last comment distinct(findPattern(%{issue.lastComment},"(?<=\\[~).*?(?=\\])")) | Assuming
this example returns the following text list: ["demo", "user"] |
Extract all issue keys from the last comment findPattern(%{issue.lastComment},"([A-Z][A-Z0-9]+)-\\d+") | Assuming
this example returns the following text list: ["DEMO-1", "DEMO-2"] |
Extract all URLs from a text field findPattern(%{issue.somefield},"(?<=\\|http:\\/\\/|\\|https:\\/\\/).*?(?=\\])") | Assuming
this example returns the following text list: ["apps.decadis.net", "apps.decadis.net/display/JWT", "www.google.com"] |
Parameters used in this function
Parameter | Input (data type) | Description |
---|---|---|
text | TEXT | Any given text. |
regex | TEXT | A valid regular expression that grabs all substrings to be returned. |
This function returns a TEXT LIST
If you want to ignore the case, have a look at the findPatternIgnoreCase() function.
Parser expression | Output |
---|---|
findPatternIgnoreCase("Grass is Green and Sky is Blue.", "red|green|blue") | ["Green", "Blue"] |
findPattern("Grass is Green and Sky is Blue.", "red|green|blue") | [ ] |