Forums

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

isolate a number in a text

Regis MAHOUKOU March 31, 2025

I want to isolate a number from a text for automation.
I tried match, split and replace functions but not working.

Someone can help ? 

2 answers

0 votes
Sergei Troshin
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 31, 2025

Hi @Regis MAHOUKOU and Welcome to Atlassian Community!

It's easy to do with a Regex expression.

For example, I have a description with the current value:
screen1.png

And I have the following automation:
screen2.png

After execution, I'll get:
screen3.png

 

I recommend you this site Pattern class and this article rules documentation around regular expressions

If you encounter any difficulties, feel free to ask me, and I'll do my best to help.

Regis MAHOUKOU March 31, 2025

Thank so much @Sergei Troshin 

I've successfully tested your example.

The issue I have : "Effort" field contains a textd "3 Medium" that need to be isolated.

The functions replaceAll, split or match are not working on this.

 

Automation Effort.png

Sergei Troshin
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 31, 2025

Hi @Regis MAHOUKOU 

1) Do you have a text field named "Effort"? Or what is the field type?
2) Do you need to extract "3" from the value "3 Medium"?

 

Regis MAHOUKOU April 1, 2025

Yep Effort is text field conatining this "3 Medium". I want to catch the number 3 so I can use it for calculation.

Sergei Troshin
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.
April 1, 2025

Hi @Regis MAHOUKOU again!

It works:

{{#=}}{{issue.customfield_10058.replaceAll("[a-zA-Z]","")}} * 2{{/}}

screen1.pngscreen2.png

I successfully removed all letters, multiplied the result, and put it into a Number Field.

0 votes
Richard Cho - ServiceRocket
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 31, 2025

@Regis MAHOUKOU can you provide an example?

Regis MAHOUKOU March 31, 2025

Hi @Richard Cho - ServiceRocket 

I am blocked on with the Split function

Automation Effort.png

Regis MAHOUKOU March 31, 2025

Is the Regex functions activated by default for Automation in JIRA ?

Suggest an answer

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

Atlassian Community Events