Jira Query Language (JQL) is a powerful tool that allows you to search for issues within Jira. By leveraging JQL, you can create complex queries to extract the exact information you need from your Jira projects. One of the most useful features of JQL is the ability to use wildcards, which can help make your searches more flexible and powerful. In this guide, we'll explore how to use wildcards in JQL effectively.
Wildcards in JQL are special characters that represent one or more characters in a string, allowing for more flexible and broad search criteria. Jira supports two main wildcards in JQL:
The asterisk (*) wildcard represents zero or more characters. It's particularly useful when you want to search for issues that contain a particular string anywhere within a field.
Basic Usage
Suppose you want to find all issues where the summary contains the word "error". You can use the following JQL
summary ~ "*error*
"
This query will return all issues with summaries that include the word "error", such as "Server error", "Network error detected", or "Unexpected error".
Advanced Usage
You can combine the asterisk wildcard with other strings to refine your search. For example, to find issues with summaries that start with "Deploy" and end with "success", use:
summary ~ "Deploy*success"
The Question Mark (?) Wildcard: The question mark (?) wildcard represents exactly one character. It's useful when you need to find issues where a field matches a specific pattern with a single character variation.
Basic Usage
To find issues where the summary contains "bug" but with any single character before it (e.g., "debug", "nbug", etc.), use:
summary ~ "?bug"
This will return issues with summaries like "debug", "nbug", etc.
Advanced Usage
You can use multiple question marks to match a specific pattern. For instance, to find issues where the summary contains a specific three-character prefix followed by "fix", use
summary ~ "???fix"
This will return issues with summaries like "Bugfix", "Hotfix", "Newfix", etc.
Wildcards can be combined with other JQL functions to create even more powerful queries. Here are a few examples:
Using Wildcards with AND/OR
To find issues that contain "error" in the summary and are assigned to a specific user, use
summary ~ "*error*" AND assignee = john.doe
This query will return issues with summaries containing "error" that are assigned to John Doe.
Using Wildcards with Specific Fields
To find issues where the description contains the word "failure" and the status is "In Progress", use
description ~ "*failure*" AND status = "In Progress"
This query will return issues with descriptions containing "failure" and a status of "In Progress".
Combining Wildcards with Date Ranges
To find issues created in the last month where the summary contains "update", use
summary ~ "*update*" AND created >= startOfMonth(-1)
This query will return issues with summaries containing "update" that were created in the last month.
Mastering wildcards in Jira Query Language (JQL) can significantly enhance your ability to find and manage issues within Jira. Whether you're looking for issues with specific keywords, patterns, or a combination of both, wildcards provide the flexibility needed to refine your searches and get precise results. By following the examples and best practices outlined in this guide, you'll be well on your way to becoming a JQL expert.
Happy querying!