regex url for ticket ID
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

i have some jira urls like this


and we need to be able to parse out of the url the ticket ID. From the examples above and clicking around all the ways to see things in jira that we are looking for something that fits the following pattern

-has a hyphen in it (this is probably the key in the expression)
-alpha before the hyphen (this is between 2 and 8 characters ALWAYS)
-numeric after the hyphen (will ALWAYS be numeric)

the output of the regex should be two parts:

1- the ID by itself, for example AU-437

2- a reformatted link to the ticket - we can use this template{ticketID_here}

if you dont mind please use this for submitting solutions it makes things a lot easier to test and verify. Thanks!

awarded to B44ken

Crowdsource coding tasks.

5 Solutions

Winning solution

This is the Regex part: How do you want the reformatting part done?
I did it in Python, I can do other languages if you're working in something else (probably):

Can the script append the parsed ID to the template stub url front? ""
Qdev 3 months ago
I updated my answer with a link, because Bountify's Markdown parser seems to not like comments and thinks they're headings.
B44ken 3 months ago
Python works!
Qdev 3 months ago

\n@media print {
\n html, body {
\n overflow: hidden;
\n }

View Timeline