The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Split URL to return only Text value

Mihir Vibhu
May 28, 2024

Hi team,

 

I am trying to split URL of this form "https://abcde.grey.company/department/123456/overview" to just get 123456 in custom field. 

I am not sure which function to use as the numerical value in the URL might be of 7/8 digit or even 5/6 digit long,. 

2 answers

2 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
Kalyan Sattaluri
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 Champions.
May 28, 2024

Hello @Mihir Vibhu 

If this URL format will not change and you need to extract the Dept ID, you can keep it simeple and use

{{Text 1.substringAfter("department/").substringBefore("/")}}

where {{Text 1}} holds the URL and replace it with whatever smart value holds your URL.. but if you have complex extraction, you have to use match/regex functions.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#substringAfter--String-separator-

Hope it helps. Thanks!

Mihir Vibhu
May 28, 2024

It works like magic. Thank you Kalyan

Like Kalyan Sattaluri likes this
Mihir Vibhu
May 28, 2024

Hello @Kalyan Sattaluri , 

stumpled upon a blocker. Looking into the raw data, we might have some links with 

"https://abcde.grey.company/user/123456/profile" and may contain some other variant. 

What would be your suggestion to ensure we cover all variation  ?  

0 votes
Answer accepted
Fernando Eugênio da Silva
Community Champion
May 28, 2024

@Mihir Vibhu 

You can just use the substring resource. Like this: {{issue.customfield_XXXX.substringBetween("=","&")}}

 

Create a variable for your link, like called: URL

 

Then use a substring: {{URL.substringBetween("department/","/overview")}}

 

Try this and let us know if you have any questions.

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events