Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

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

Issue with pattern match in Jira automation

Neil B January 27, 2022

I am trying to parse the description field of a ticket raised by a separate integration.

The description field contains:

*Organization:* ABCTECH
*Owner:* John Smith

And I am trying to set another field's value using:

{{issue.description.match("(?<=Organization:\* ).*")}}

 

Testing the regex separately returns the match, the automation runs, but the field is never populated.

3 answers

1 accepted

2 votes
Answer accepted
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 Leaders.
January 27, 2022

Hi @Neil B -- Welcome the Atlassian Community!

Have you tried a simpler match expression to return the value, perhaps to the audit log before trying the field edit?

In my experience thus far, the regular expression handling for automation rules does not consistently implement the references in the documentation.  And, even within a rule some different rule components may lead to different behaviors...particularly when leading/trailing smart value expressions collapse to null.

Kind regards,
Bill

Neil B January 28, 2022

Hi Bill - thanks. This could be my misunderstanding of how match works.

 

In my regex test with {{issue.description.match("(?<=Organization:\* ).*")}} against

*Organization:* ABCTECH
*Owner:* John Smith

I get no results. With a simpler {{issue.description.match(".*(Org).*")}} it does match and returns 'Org'.

When I test the regex elsewhere I get for "(?<=Organization:\* ).*"

 

Screenshot 2022-01-28 130113.png

And then for ".*(Org).*"

Screenshot 2022-01-28 130145.png

So it looks like match is returning group index 1?

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 Leaders.
January 28, 2022

Yup...Maybe divide and conquer this one by splitting to lines to isolate the searching.  This worked for me when I tried your example description:

{{issue.description.split("\n").match(".*Organization:\*(.*)")}}
Like # people like this
Neil B January 31, 2022

That's great Bill, thanks! I'd used substringAfter/substringBefore as a quick workaround but this is much better.

Like # people like this
0 votes
Rick van Twillert _TMC_
Contributor
August 7, 2024

I've been struggling with a similar case and i found that enabling dotall mode fixes it.

In dotall mode, the expression . matches any character, including a line terminator. By default this expression does not match line terminators.

You can enable this by adding the embedded flag expression (?s) in front of your expression.

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 27, 2022

Hi Neil - Welcome to the Atlassian Community!

Can you share the rule that you have (screenshot)? And the Audit log for when you run it?

Neil B January 27, 2022

Hi John - thanks!

Screenshot 2022-01-27 211417.pngScreenshot 2022-01-27 211333.png

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 27, 2022

Thanks for sharing. And what does the value for the Summary field look like after the update? 

Neil B January 28, 2022

just has ' org' in it (but is being changed from it's initial value 'New deal won')

Screenshot 2022-01-28 092949.png

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 2, 2022

Glad Bill got you all fixed up. 

Suggest an answer

Log in or Sign up to answer