Forums

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

substringBetween

Myles Boyd
Contributor
March 27, 2025

Trying to use this

{{issue.description.substringBetween("Serial number:"," Issue")}}

to parse this

An issue was closed for the Google Meet hardware 1.11 Uxbridge (abc, 1).

Issue: Missing monitor
Issue type: Peripheral
Issue opened: 2025-03-27T11:07:47+00:00
Issue closed: 2025-03-27T12:08:35+00:00
Annotated location: xyz
Asset id: -
Serial number: ABC12345
Issue id: 5880069409818180584
Google Admin Device Details page: url

This notification is managed in Google Admin > Devices > Google Meet
hardware > Settings and policies

OpsGenie Alert

But it returns an empty string; any ideas or pointers appreciated.

2 answers

1 vote
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 27, 2025

Hi @Myles Boyd 

The problem is likely from the newline characters in the Description text causing the search to halt.  Many of the text functions have problems when there are newlines in the text.

The solution is to first replace all of the newlines with spaces:

{{issue.description.replace("\n", " ").substringBetween("Serial number:"," Issue").trim()}}

I also added a trim() to the end to remove any stray spaces.

 

TIP: when you need the newlines for later processing, they could be replaced with some known text, parsed, and then replaced back to newlines.  For example, we could use a double-tilde ~~ as that seems unlikely to be used:

{{issue.description.replace("\n", "~~").substringBetween("something", "somethingElse").trim().replace("~~", "\n")}}

 

Kind regards,
Bill

Myles Boyd
Contributor
March 27, 2025

Thanks Bill; giving that a try

0 votes
Christopher Yen
Community Champion
March 27, 2025

The leading space on Issue in your smart value could be something to check, you can try

{{issue.description.substringBetween("Serial number:", "Issue id:")}}

or possibly just the new line

{{issue.description.substringBetween("Serial number:", "\n")}}
 

 

Suggest an answer

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

Atlassian Community Events