Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.