is there a way to select a string between a string and new line?

Rajeev Chaudhary February 24, 2022

I am trying to use automation and want to place a value from the description to a custom field.

 

Eg Description contains -

Brush Size: 2

Paint: Blue 2291 54

 

Wall#: 34

 

i have a custom field called Paint and to map the value to that field, i am using the following:

 

{{issue.description.substringBetween("Paint: ","Wall#: ")}}

 

its returning: Blue 2291 54{color} {color:#172B4D} as its reading the color of the new line between 1st row of "Paint: " & "Wall#: "

 

Is it possible to use between function for capturing strings between a string and a new line?

 

thanks in anticipation

1 answer

1 accepted

5 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.
February 24, 2022

Hi @Rajeev Chaudhary -- Welcome to the Atlassian Community!

Yes, that is possible.  Try to split the description on the newline character first, producing a list of lines. That will simplify your search using a regular expression with the match() function.  For example:

{{issue.description.split("\n").match("Paint:(.*)").trim()}}

Please adjust as needed if you need to remove/add any spacing.

Kind regards,
Bill

Rajeev Chaudhary February 28, 2022

thank you so much!

Like Bill Sheboy likes this
Rabbit Stoddard
Contributor
April 22, 2022

This also solved a problem I was having; thank you very much!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer