In JIRA, we have a ticket creation policy in which you must provide the unit number in the form of four digits at the beginning of the topic, e.g. 1111, 1234, etc.
Is it possible to create a filter that will show reports where such a number is not included in the topic?
if it was one constant number, e.g. 5555, it would be a simple query: summary !~ "5555" but how to make the query search based on summary !~ "any 4 digits"?
Is there any special character in JQL that replaces any digit in queries?
Answers
In JIRA's JQL (JIRA Query Language), there isn't a special character to represent any digit directly. However, you can achieve your goal by using regular expressions (regex) in combination with JQL's ~
(contains) or !~
(does not contain) operators.
To search for issues where the summary does not contain any four-digit number at the beginning, you can use a regex pattern like ^[0-9]{4}\b.*
to match any four digits at the beginning of the summary.
Here's how you can use it in a JQL query:
summary !~ "^[0-9]{4}\b.*"
Explanation of the regex pattern:
^
: Matches the start of the string.[0-9]{4}
: Matches any four digits.\b
: Asserts a word boundary to ensure that the four digits are at the beginning of a word (i.e., not part of a longer number)..*
: Matches any characters (zero or more) after the four digits.
This query will return issues where the summary does not start with any four-digit number.
Keep in mind that regex support in JIRA's JQL may be limited, so complex regex patterns may not work as expected. It's always a good idea to test your JQL queries with sample data to ensure they produce the desired results.