Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Regex is duplicating parts of a URL


Hey everyone, 

I'm trying to create an automation that when a link to an external Jira issue is added to the comments, it pastes the link into a custom External URL field. I'm new to regex so to test it I'm just having Jira bot return a comment with the URL.

When I add the URL into a comment as a hyperlink, Jira bot returns the URL back twice. However, If I paste a non-hyperlinked URL into the comments, it works correctly.


I'm not exactly sure what I'm missing when I try to insert {{issue.comment.last.body.match("(https:\/\/\/browse\/ABC-\d+)")}} into the comment. 


Any help is greatly appreciated. 

1 answer

1 accepted

0 votes
Answer accepted

Hi @Patrick Haley 

If you were to export that issue with the comment and look at the body, I expect you will see it includes something like this


So the URL is in there twice and so needs to be parsed accordingly, such as using the Match to make it a list, and then returning only one entry.

Best regards,

How do you make a list from the match and then return just that value?

I can think of two ways to accomplish your goal:

  • no list: Modify the regex to account for that pipe symbol (so you only get one URL), and then strip off the extraneous characters with the replaceAll function
  • with list, and easier: Please note in your comment how Match added a comma between the values, so it should already be a list.  You can just grab one by adding .first after your Match call.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events