Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira Automation: Use regex capture group from rule condition in subsequent action?

Deleted user February 15, 2021

I have an automation rule that triggers when a comment is added to an issue.  The new comment is searched using a regex, looking for something like "[tw] 5m" at the beginning of a line.  So far so good:

Screen Shot 2021-02-15 at 12.34.10.png

I then want to do something in a rule action with the "5m" captured in my regex.  Within the regex, I would simply use "\1" to refer to the contents of the capture group, but I have no idea if I can recall the contents of the capture group in a subsequent action, and, if I can, how I would recall the contents so that I can use them.  It seems like some smart value or other is what I need, but I can't find any smart values that reference the results of a regex match.

Or should I forget about capturing in the conditional step, and instead use something like `{{comment.body.match("^\[tw\]\s*(\d+[wdhm])")}}` for setting the value of a field in an action step?  Also, when using the .match method, where do the regex options (e.g. "gim" in the screenshot regex above) go?

Thank you.

1 answer

0 votes
Ravi Sagar _Sparxsys_
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 Leaders.
February 15, 2021

Hi @[deleted] 

Have you tried creating a variable?

Ravi

Deleted user February 15, 2021

Hi @Ravi Sagar _Sparxsys_

Being relatively new to Jira -- but coming from an engineering and development background -- a variable sounds like exactly what I need, but I don't know where to begin with creating one.  Can you please refer me to relevant documentation?

Thank you,

-Brian

Sherry Goyal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 22, 2021

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events