I’m working with JIRA Query Language and keep seeing the asterisk (*) symbol used in different queries. I know that JQL doesn’t support regular expressions like other query languages do.
When I run searches with and without the asterisk, I get different results but I can’t figure out the exact pattern or rule behind it. Sometimes the results seem almost the same, other times they’re quite different.
Can someone explain what the * symbol actually does in JQL queries? Is it some kind of wildcard character? How does it affect the search behavior and when should I use it versus leaving it out?
I’ve been experimenting with queries like:
summary ~ "bug*"
summary ~ "bug"
But I need to understand the specific function of this symbol to write better searches.
totally! the asterisk is a wildcard, but yeah, watch out for performance issues if you use it too much. i prefer to use it at the end like “bug*” instead of “*bug” since upfront wildcards slow things down. also, it behaves differently based on the operator; it’s fab with ~ but can get weird with others.
The asterisk in JQL functions as a wildcard that matches zero or more characters at the position where you place it. When you use “bug*”, it will find issues with summaries containing “bug”, “bugs”, “bugfix”, “debugging”, or any word that starts with “bug” followed by any characters. Without the asterisk, “bug” will only match the exact word “bug” as a complete term within the text. This is why you’re seeing different result sets. I’ve found the asterisk particularly useful when searching for variations of terms. For example, “test*” catches “test”, “testing”, “tested”, and “tester” in one query instead of running separate searches. You can also use it at the beginning like “*fix” to find words ending in “fix”. One thing to watch out for is performance - wildcard searches, especially with leading asterisks, can be slower on large instances. Also, remember that the wildcard works with the contains operator (~) but behaves differently with the equals (=) operator in JQL queries.
Indeed, the asterisk is a wildcard character in JQL, serving a specific purpose in text searches. When you use “bug*”, it captures any term starting with “bug” followed by any characters, whereas simply using “bug” will limit the results to that exact word. It’s crucial to place the asterisk correctly based on what you want to find. You can use it at the end, beginning, or both sides of a term. However, using an asterisk at the beginning can slow down performance, especially in large datasets. For searching variations in names or project keys, the asterisk is particularly useful, eliminating the need for multiple OR conditions.