Forums

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

Jira automation rule: Capture a string ending with 2 options

William van Dalen
Contributor
March 15, 2025

Hi,

A Jira smart value question in an automation rule :

In the description of a Jira issue i captured a string until this string ends with a new line. This works fine.

{{issue.description.substringAfter("Subject").split("\n").first().

However, sometimes instead of a new line (\n) the string ends with a horizontal line (---). Hoe can i combine this (thus new line and horizontal line).

Regards, Will

 

1 answer

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.
March 15, 2025

Hi @William van Dalen 

How often do you expect the "---" text in your Description, in what format / length, etc.?

You could try first replacing multiple occurrences of hyphens with a single newline using the replaceAll() function and a regular expression.  For example:

{{issue.description.replaceAll("(\-{3,})", "\n").split("\n").first}}

When you expect multiple hyphen sections / horizontal lines, you may need to account for which record to access, rather than assuming it is the first one.

 

Kind regards,
Bill

William van Dalen
Contributor
March 24, 2025

Hi Bill,

With your reply eventually i wrote {{issue.description.substringAfter("Subject:").replaceAll("---", "\n").split("\n").first()}}.

I tested it and i sent it to the consultant. It looks that it's okay.

Thank you for your support.

Regards, Will

Like Bill Sheboy likes this

Suggest an answer

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

Atlassian Community Events