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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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 Community Leader Feb 15, 2021

Hi @Brian Oak 

Have you tried creating a variable?

Ravi

Hi @Ravi Sagar

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Jira Service Management

Security Advisory for Jira Service Management

On October 20, 2021, Atlassian published a security advisory for Jira Service Management. The full advisory is available at this link.  We've seen a number of questions already asking for...

208 views 1 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you