The issue Description is like the one in the example below.
I'd like to extract only Text2 from Device.
Which expression can I use?
Description :
Date
Text1
Device
Text2
Text3
Location
Text4
Text5
Text6
I tried substringBetween(Device,Location) but it captures both Text2 and Text3. I want only Text2. Is there any way to capture the line after Device
Hi @Creative Ideas ,
I would try using a different expression to extract Text2 from your example. Can you try this :
{{issue.Description.substringAfter("Device").trim()}}
Let me know if this helps,
--Alexis
Hi @Alexis Robert - Thanks for your support. But it captures all the text after Device.
Below is the output.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Creative Ideas -- Welcome to the Atlassian Community!
Adding to Alexis's answer...
Your description appears to contain newlines (line feeds) and so building on the earlier suggestion, the result could be split() and then grab the first result.
For example:
{{issue.description.substringAfter("Device").split("\n").get(0).trim()}}
To learn more about these text and list functions, please review this documentation:
This may also be possible to do in one step with the match() function, using a regular expression.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy @Alexis Robert - Below script worked. Thank you!
{{issue.description.substringAfter("Device").split("\n").get(0).trim()}}
If possible can you please share the script with match() function.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.