Forums

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

How extract first occurence of match in Description in Automation for Jira

Jeff Gordon
Contributor
August 5, 2022

I am using Automation for Jira to set the value of a field based on extracting a value from the Description.  In my case the Description will contain multiple lines with the relevant ones as in the following example...

Detailed Order

Supplier This Supplier

Supplier That Supplier

Ship to Some Address

Supplier Order

The value I want is "This Supplier" and I am using the following expression to attempt to extract it.

{{issue.description.split("\n").match("Supplier (.*)").first}}

Unfortunately I always get "That Supplier".

Any ideas on the correct way to do this?

1 answer

1 accepted

0 votes
Answer accepted
Mykenna Cepek
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.
August 5, 2022

I tried your example in our Jira Server instance, and it seemed to work fine.

I updated the Description of an existing issue:

  • 1.PNG

I used the smart value expression you listed in a Log Action:

  • 2.PNG

And I manually invoked the rule on that issue. The result:

  • 3.PNG
Jeff Gordon
Contributor
August 8, 2022

Thanks for confirming this should work.  I will check to see if there's something else in the Description (it's actually much larger than my snippet) that's possibly impacting this.

Jeff Gordon
Contributor
August 8, 2022

Got this working.  Discovered that the spacing between the "Supplier" and the following value wasn't always a single space.  So modified the match patten to "Supplier\s+(.*)" and it finds the correct occurrence.

Like Mykenna Cepek likes this

Suggest an answer

Log in or Sign up to answer