What is the default stash jira key pattern doing?

By default, Jira is started with the following value for the stash.jira.key.pattern argument:

((?<!([A-Z]{1,10})-?)[A-Z]+-\d+)

To ignore case, I was thinking of changing this to:

\b(\p{Alpha}+-\p{Digit}+)\b

Here I have omitted the negative lookbehind term:

([A-Z]{1,10})-?)

I know I could just include it or modify it in a simlar way:

((?<!(\p{Alpha}{1,10})-?)\p{Alpha}+-\p{Digit}+)

But what am I losing by not including it?

1 answer

1 accepted

1 votes

Hi Ken,

The negative lookbehind is used to make the JIRA key matching a bit stricter. Specifically, it ensures that things like Crucible review keys (e.g CR-FE-1234) and Bamboo builds (e.g. STASH-MASTER-1234) are not matched. If you leave it off, you'll probably get a few more false positives.

Cheers,

Michael

I can see that case but what does making the first dash optional acheive? And why is it captured? That is, why is the term:

([A-Z]{1,10})-?)

and not:

[A-Z]{1,10}-

Or, for that matter, why not just the dash, so that the expression becomes:

((?<!-)[A-Z]+-\d+)

Okay. The original is not looking for a word boundary like I was going to do. I am going to try:
\b(?<!-)(\p{Alpha}+-\p{Digit}+)(?!-)\b

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,128 views 13 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot