I'm using the JQL Match feature to regex against an incoming webhook text for matching issue keys.
By default, the .match() function will return either a single issue key, or a set of issue keys. There isn't an option to always return only the first match.
Using .match().first returns the first result, but only works if a collection was found, doesn't work if only one key exists. Calling .first on a single issue just returns a blank result.
I end up with this workaround which looks a bit messy, but will limit the result to only one issue key:
{{webhookData.pull_request.title.concat(" DUMMY-3535").match("\b([A-Z]+-\d+)\b").first)}}
If there's a better way, please let me know. Thanks!
Hi David,
Yeah sorry - your workaround is the only way to achieve this currently. For convenience reasons, if there's only a single match, then we just return that match (not an array), which works great in 90% of the use-cases of this method where users just want to match a single bit of text.
In this case that approach breaks down though, so you need to go with the work-around that you've put in place.
Cheers,
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.