Forums

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

Automation: how to extract a word from description

Antonio Calì
Contributor
October 10, 2023

The issue description is like the one in the example below.

I'd like to extract word2 after Section.

Which expression can I use? 


Device
word1

 

Section
word2

 

Area
word3

1 answer

1 accepted

1 vote
Answer accepted
Sanjog Sigdel
Community Champion
October 10, 2023

Hello @Antonio Calì 

Here is one function to manipulate the text using jira smart values.

If you want to get the texts after word2 section than use this function:

substringAfter( String separator)

Returns the text after the first occurrence of the given separator.


{{issue.summary.substringAfter("word2")}}

Input : This is the word2 reporting about an issue!
Output:  reporting about an issue!

For more information, see this reference from atlassian documentation: StringUtils.substringAfter(String).

Antonio Calì
Contributor
October 10, 2023

Hello  @Sanjog Sigdel  thanks for your reply, so if I want to extract  "word2" right below "Section" I can use:

{{issue.summary.substringAfter("Section")}}

 

The output looking at my sample issue Descripion will be: word2

Like Sanjog Sigdel likes this
Sanjog Sigdel
Community Champion
October 10, 2023

Yes you can. Though this will be a task specific automation. For ever new word you want to separate the summary, you should create a new automation action.

Antonio Calì
Contributor
October 10, 2023

It doesn't work, I suppose because word2 is in a newline below Section

Like Sanjog Sigdel likes this
Antonio Calì
Contributor
October 10, 2023

sorry, I was wrong. It extracts everything obviously after Section:

Output: * word2 *Area* word3 *

 

I'll try:

 substringBetween(String open, String close)

 

to get only word2

Like Sanjog Sigdel likes this
Sanjog Sigdel
Community Champion
October 10, 2023

Glad it helped to answer your question. Thank you for accepting the answer. Will be helpful for future reference.

Suggest an answer

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

Atlassian Community Events