A few weeks ago we introduced Bitbucket Links, which among other things makes it possible to integrate Bitbucket to your JIRA issue tracker by using issue keys in your commit message. We have just rolled out an update for this feature that allows you to specify custom regular expressions and custom replacement URLs. Link your repositories to content that matters to you without having to wait for the Bitbucket team to roll out support for it.
To link your own custom regex and replacement URLs, enter the Links configuration in a repository’s Admin settings. Bitbucket supports the Python regex replacement syntax, and you can reference your regex capture groups in your replacement URL via the syntax \1, \2.
For example, the URL http://jira.atlassian.com/browse/\1 matched with the regex (BB-\d+) will link your JIRA issue keys that start with BB-.
We were going to include this functionality when we originally launched the feature but we were worried about the effect of ReDoS on Bitbucket’s performance. However, thanks to the power of Erik’s awesome interrupting cow utility, we are able to bound the total execution time of the linking we perform and push out this feature.