Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do you extract details from an ordered list using Regex in Jira Cloud Automation?

James_Kostiuk
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 18, 2026

I'm trying to extract a piece of text from a ticket's description and post it in a comment.

Sample description:

image.png

Using regex101 set to Java the following regex seems to match the correct body:

image.png

However when I use this in the automation I get nothing back. When I remove the terminal string "Out of scope"

image.png

I get the first line "Acceptance Criteria:" but nothing after

image.png

 

What am I missing here? Can someone assist?

1 answer

1 vote
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 18, 2026

Hi @James_Kostiuk 

Short answer: try using text functions and / or the simplest possible regex and then experiment to confirm it works as desired.

 

First thing: there is no documentation on what actual is, or is not, supported with regular expressions in automation rule handling.  What the documentation states, with italics added by me:

The underlying implementation is based on Java's Pattern class and uses Matcher.find() to find matches...

There are many community posts where people tried something which works with online regex validators which does not work in rules.  Two known causes are: racetrack timing problems and the order in which escaping happens.  Additionally, the match() function specifically seems to have intermittent problems when there are newline characters in the source expression.

My recommendations are:

  • use a test rule to extract information which does not alter anything; for example...
    • create a Scheduled Trigger rule which can be manually run repeatedly from inside the rule editor
    • only write to the log without altering work items
    • when done, change the trigger and actions to implement the full scenario
  • use the simplest regex that can possibly work, and as needed...
    • incrementally add to the expression and test results
    • consider chaining match() functions with different regex to progressively extract information: {{issue.description.match(someRegEx).match(moreRegex)}}
    • remember that match() can produce a list result, so ensure that is handled
  • match() has problems with newline, and also any embedded characters matching regex tokens, and so a workaround for the newline problem is:
    • replace all newlines in the source with known characters, such as replace("\n", "~~")
    • perform the match, accounting for changes of newlines
    • replace the substituted characters back to newlines, or empty strings
    • all to together, an example would be:
      • {{issue.description.replace("\n", "~~").match(varMyRegEx).replace("~~", "\n")}}
  • one more possible wrinkle is the match() function cannot accept a work item field or concatenated string as a regular expression; that is, a dynamic regular expression
    • the mitigation for that is to pre-build the regex in a Created Variable, without the surrounding quotation marks, perhaps named varMyRegEx
    • then use that variable in the match: {{issue.description.match(varMyRegEx)}}
    • this technique also helps when the regex needs to dynamically escape search characters

 

Perhaps start with a test rule and simple regex, and incrementally modify the expression from there.

 

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events