It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Search for issues that do not contain text

I need a simple solution for a JQL

eg: 

issuetype = Bug AND text != Apple

 

the != operator is not supported with text search. 

6 answers

1 accepted

5 votes
Answer accepted
Ignacio Pulgar Community Leader Jul 19, 2019

Have just stumbled upon this old answer and felt the necessity to correct it, as suggested.

However, for consistency with the dates of previous comments, I'll post the correct answer within this comment instead of editing the original answer:

You can get all issues that do not contain the word 'Apple' by following these steps:

  1. Execute the following JQL: text ~ Apple
  2. Save your search as a filter, ie named "With Apple".
  3. Finally, execute this new JQL: filter not in ("With Apple")

After that, you'll get the list of issues that do not contain the word 'Apple'.

My original answer stated I didn't test it, so I was probably answerring posting from my mobile phone...

My main point was that '!~' should be used instead of '!=' with text fields.

As text function is sometimes used as a lazy way to avoid having to write longer JQLs which actually would target Summary and Description fields, some people might have found the correct syntax of DOESN'T CONTAIN '!~' a useful answer every now and then.

But, of course, the correct answer is the one I've just included into this comment.

Sorry for not having noticed this mistake before!

Best regards.

7 votes
Ignacio Pulgar Community Leader Mar 17, 2016

issuetype = Bug AND summary !~ "*On Production*"

Try with 'text' instead of summary, as I can't test now if it works as well.

Thanks, but no. Text does not accept != as an operator. 

Dave, !~ is different from !=

Thanks! !~ works perfectly.

I cannot get the !~ to work with the text field. It works in summary, but does not appear as an option for text searches. If you force it, it doesn't work.

Why is this the accepted answer? 'text' and 'summary' are different fields in JIRA. The OP is asking about the 'text' field which does not support the !~ operator.

Agree.  This answer is completely wrong and should be un-accepted.  You cannot use "!~" on text.

How can I negate a match on text?

This answer does not work for 'text'... should not be marked correct

Ignacio Pulgar Community Leader May 09, 2018

Have just stumbled upon this old answer and felt the necessity to correct it, as suggested.

However, for consistency with the dates of previous comments, I'll post the correct answer within this comment instead of editing the original answer:

You can get all issues that do not contain the word 'Apple' by following these steps:

  1. Execute the following JQL: text ~ Apple
  2. Save your search as a filter, ie named "With Apple".
  3. Finally, execute this new JQL: filter not in ("With Apple")

After that, you'll get the list of issues that do not contain the word 'Apple'.

My original answer stated I didn't test it, so I was probably answerring posting from my mobile phone...

My main point was that '!~' should be used instead of '!=' with text fields.

As text function is sometimes used as a lazy way to avoid having to write longer JQLs which actually would target Summary and Description fields, some people might have found the correct syntax of DOESN'T CONTAIN '!~' a useful answer every now and then.

But, of course, the correct answer is the one I've just included into this comment.

Sorry for not having noticed this mistake before!

Best regards.

Like # people like this

Can confirm Ignacio Pulgar [Tecnofor]'s comment, this is an acceptable solution for searching "Does not contain this text". I do not know why, but it seems that the !~ operator does not work for text. 

 

As a note to this solution, you will likely have to include the majority of your search in the second query, see below example as an explanation.

You run a bakery and track your recipe creations in JIRA. The project is MyBakery, your epics are a custom issuetype called Recipe, and you want to find all of your recipes that do not contain Apples.

This will return all of your project specific recipes that include the word apples.

project = MyBakery AND issuetype = Recipe AND text ~ Apples

Save this as a filter, for this example, the filter name is 100.

 

In a new query, you can write...

filter != 100

This will return EVERYTHING in JIRA that is not in that filter. So to have it specific to your search you would rewrite the first half of your first search.

project = MyBakery AND issuetype = Recipe AND filter != 100

This will return all of the appropriate items that are not including the text Apples. 

 

Additionally, you can add multiple text options to mask out. If you had a customer who was allergic to Apples and Bananas, you could put in the first query 

project = MyBakery AND issuetype = Recipe AND text ~ "Apples OR Bananas"

 

Your JIRA version will dictate the correct syntax, see https://community.atlassian.com/t5/Answers-Developer-Questions/How-can-i-use-the-like-operator-with-the-List-of-values-in-Jira/qaq-p/545519 for reference.

Like Mike Roger O Sullivan likes this

?? Opposite of my need. Using ~ would result in what issues I do not want to see. 

If I have 100 cake recipes, of many various kinds, but hate Apples and don't want to see any of the recipes that include the use of Apple. 

examples:

~ Apple = show me recipes (issues) with Apple in them

!~ Apple = do not show me recipes (issues) with Apple in them

 

I want a JQL for the latter of these examples. 

Can confirm Ignacio Pulgar [Tecnofor]'s comment, this is an acceptable solution for searching "Does not contain this text". I do not know why, but it seems that the !~ operator does not work for text. 

As a note to this solution, you will likely have to include the majority of your search in the second query, see below example as an explanation.

You run a bakery and track your recipe creations in JIRA. The project is MyBakery, your epics are a custom issuetype called Recipe, and you want to find all of your recipes that do not contain Apples.

This will return all of your project specific recipes that include the word apples.

project = MyBakery AND issuetype = Recipe AND text ~ Apples

Save this as a filter, for this example, the filter name is 100.

 

In a new query, you can write...

filter != 100

This will return EVERYTHING in JIRA that is not in that filter. So to have it specific to your search you would rewrite the first half of your first search.

project = MyBakery AND issuetype = Recipe AND filter != 100

This will return all of the appropriate items that are not including the text Apples. 

 

Additionally, you can add multiple text options to mask out. If you had a customer who was allergic to Apples and Bananas, you could put in the first query 

project = MyBakery AND issuetype = Recipe AND text ~ "Apples OR Bananas"

 

Your JIRA version will dictate the correct syntax, see https://community.atlassian.com/t5/Answers-Developer-Questions/How-can-i-use-the-like-operator-with-the-List-of-values-in-Jira/qaq-p/545519 for reference.

You can use the "Power JQL" app - https://marketplace.atlassian.com/apps/1216891/power-jql-extended-search-functions?hosting=server&tab=overview
Which provides the ability to search by text fields using regex.
A few examples:
issue in powerIssue("project = SD", "summary,description", "^ABC-.*")
issue in powerIssue("project = SD", "text", ".*(bug|test).*") - for search by summary, description, comments.

Do you want to match the exact text ? If not then you can use the contains (~) and in your case can be does not contain (!~) 

what is the JQL i have to user if i need exact text? Using ~ symbol it returns all issues that has the particular search string.  But i need only those issues that are exactly match to the search string.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

1,214 views 8 1
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you