I have tried everything to get an exact match on an If statement in an automation, but it keeps coming up with putting the issue in both categories. The issue has the label of "DEV-APPROVAL" but it keeps getting added to the "DEV" section. Here are the if statements.
{{#if (labels.match("(DEV-APPROVAL)").size.gt(0))}}
{{#if (labels.match("(DEV)").size.gt(0))}}
Sample of code
{{#issues}}
{{#if (labels.match("(DEV-APPROVAL)").size.gt(0))}}
<ul style="font-size:18px;">
<li><strong><a href="{{url}}">{{key}} - {{summary}}</a></strong>
<ul><strong><li>Description:</strong>{{description.html.remove("<p>").remove("</p>")}}</li>
***and more***
{{#issues}}
{{#if (labels.match("(DEV)").size.gt(0))}}
***same as above..***
Hi @Tom Scoggin
Because the DEV value is a substring of DEV-APPROVAL, the expression for match() will need to exact match, perhaps using the start and end tokens:
{{#if(labels.match("^(DEV)$").size.gt(0))}}
Kind regards,
Bill
Thanks Bill. That worked perfect. Do you know where I can find that in the documentation?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome; I am glad to learn that helped!
Regarding documentation, in the automation documentation on the match() function, it links to some regular expression information from the Java spec that rules are based upon: https://confluence.atlassian.com/automation/jira-smart-values-text-fields-993924863.html#Jirasmartvaluestextfields-matchmatch()
Please note it states "is based upon" that spec, but no where does it state what exactly is (or is not) supported. In my experience, I always test and experiment to learn what works with rules.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.