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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Links regex for enforcing commit message not working

Hello,

We are using Bit bucket cloud for our deployments. We have integrated Bitbucket with Jira Issues. Now we are planning to enforce commit strategies with Workflow Links Regex.

We are using regex value as : ^[KL]{2}-\d{4,9}: .*
Expected commit pattern should strictly follow below pattern as :

KL(hyphen)1655(colon)(space bar)first commit message.

In our case it is not working.
Can someone suggest best way to write regex for the same.

Thanks And Regards

1 answer

I can't help you with Workflow Links, but as for the regex:

Your pattern will match any combination of K or L at the beginning - KK, LL, KL, LK.
If you want a literal "KL" then you can use this instead: ^KL-\d{4,9}: .*

Hi FrankyG,

Thanks for responding.

In my case, we wanted to enforce users to follow below pattern
KL(hyphen)1655(colon)(space bar)first commit message.

For eg : if a user fails to provide space bar in between colon and commit message(i.e KL-1622:Some Commit Message) it should not be allow as valid commit since we have strictly mentioned/enforced space bar in regex.

In my case, this enforcement is not working.
It would be helpful if  you suggest some regex pattern for the same.

Thanks and Regards,
Siddhesh

Hi Siddhesh,

That regex should do what you expect. I'm not familiar with Workflow Links, so there might be something going wrong there.

I've tested the regex with some examples here: regexr.com/5bbdk (look at the Tests tab and note which tests are "Match full" and which are "Match none")

The only other thing I'd suggest is that this doesn't enforce a message after the space, which can be done with + (1 or more) instead of * (0 or more)

^KL-\d{4,9}: .+

Sorry I can't be of more help. Good luck!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,927 views 10 16
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you