Jira, Regex & Checklists
Combining checklists with automation and workflow behaviors opens up a world of possibilities for automating and streamlining processes. You can:
- Automatically close an issue when a checklist is completed
- Replace checklist items when an issue transitions to a new status
- Reset a checklist daily
- Clear a checklist when an issue is transitioned
- Mark all checklist items complete when an issue is transitioned
- Validate that all checklist items are complete before an issue can be transitioned
But what if you want to perform operations on / validate for a specific checklist item, rather than the checklist as a whole?
This is where Regex comes into the picture. Using Regex allows you to match for exact text, or a defined range in any string. You can use Regex to check for the specific text of a checklist item, or a checklist custom status. This article will provide examples of how you can use regular expressions with checklists in Jira.
What is Regex?
Regex, also known as Regular Expressions or Regexp, is a set of characters that can be used to define a search pattern in text. These patterns can be used to find text in a string, to validate input, etc. For example, given a list of file names, you could use Regex to identify only those that have a “.pdf” extension. Or you could validate that a date or a phone number in a text field is formatted correctly.
Regex is a powerful tool. However, it is not easily readable or particularly intuitive. Therefore it’s good to have a few resources available when you’re learning Regex:
- RegexLearn includes a detailed tutorial, a cheat sheet, and a playground where you can practice/test your regular expressions
- QuickRef.Me has a nicely formatted Regex cheat sheet
- Regex 101 provides a great environment for developing and testing Regex
How Can I Use Regex in Jira?
There are four places where you are likely to use regular expressions in Jira:
Using Regex with Checklists
Using regex with checklists allows you to identify:
- A custom checklist status
- A specific checklist item
- A specific checklists (when multiple checklists are used on one issue)
Here are some examples of using regular expressions with Jira checklists.
Change Status of Checklist Items to Custom Status
You can use the replaceAll function with Regex to transition checklist items to a custom status. In this case, an automation rule accessed the Checklist Text custom field to change the status of all checklist items to “Deployed” when the issue was transitioned.
![](https://cdn.prod.website-files.com/660b7241cfe490c443ab3624/667ce437d9623212d560dee0_65e8c4aa9714a881061bcfbb_Status.jpeg)
![](https://cdn.prod.website-files.com/660b7241cfe490c443ab3624/667ce437d9623212d560dee8_63ffd54f41d41ce66c844305_image-20220817-090821.png)
Validate for a Specific Checklist Item
You can use the Regex validator to check that a specific checklist item is complete. The examples below will work with both simple checkboxes and item statuses.
- To check that a checklist item called first item is complete
![](https://cdn.prod.website-files.com/660b7241cfe490c443ab3624/667ce437d9623212d560df17_65e8c8243f96ad1bfc99ddcc_FirstComplete.jpeg)
- To check that two items, called first item and second item are complete
![](https://cdn.prod.website-files.com/660b7241cfe490c443ab3624/667ce437d9623212d560deeb_65e8c8a4de3de52ed3d85ef1_FirstSecond.png)
- To check that an item in a given position (4th) on the list is complete
![](https://cdn.prod.website-files.com/660b7241cfe490c443ab3624/667ce437d9623212d560deef_65e8c977d54cd0445b5c0cae_Fourth.jpeg)
The example above will block the transition if the fourth item in the list is incomplete. To block transition if Nth item is incomplete, change the 3 in the expression above to N - 1.
Note that this expression cannot be used to validate for the first item in the list, and that the list must contain at least N items. If you want to validate for more than one position in the list, you will need to create separate validators for each position.
- To check that there are no items in an Open status
![](https://cdn.prod.website-files.com/660b7241cfe490c443ab3624/667ce437d9623212d560dee3_65e8caf7c4ffee6beffdd833_Open.jpeg)
The following regular expressions can be used to make the transition require at least one checked item, and optionally to require that checklist has at least one item. The expressions can work with or without statuses. If you use custom statuses, you will need to adjust the expressions.
![](https://cdn.prod.website-files.com/660b7241cfe490c443ab3624/667ce437d9623212d560df0b_65e8cd4a5ed092221629bc24_a-d.png)