Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Why does "comment ~" work, but "comment !~" does not?

Greg Harder September 3, 2025

I'm in the process of trying to filter my search results to exclude tickets that have comments with a specific build number mentioned in them.

I have a JQL search configured to find tickets created by me that are still open and of a certain type.  This results in 114 tickets.

I find that if I add AND comment ~ "6.4.11-1" then it works to find the one ticket in my search results that include that build in a comment.  This results in a single ticket being found.

If I use AND comment !~ "6.4.11-1" then it finds all 114 tickets again, including the one that should be excluded.

The JQL suggestions tell me this is possible, and it doesn't result in any errors.  The Atlassian documentation tells me this is possible, https://support.atlassian.com/jira-service-management-cloud/docs/jql-fields/#Comment.

Is this a bug in JIRA?

1 answer

1 accepted

4 votes
Answer accepted
Trudy Claspill
Community Champion
September 3, 2025

Hello @Greg Harder 

Welcome to the Atlassian community.

Does the issue that contains "6.4.11-1" in a comment have any other comments on it that don't contain that text?

If so, that is why the filter returns that same issue when you use AND comment !~ "6.4.11-1", and your results are not a bug.

The filter looks at each comment on the issue. If any one comment on the issue matches the filter criteria then the issue is included in the results.

 

The suggested workaround from Google Gemini is as follows:

 

The workaround is to create and save a filter for issues that do contain the text, and then search for all issues not in that filter. 
Step 1: Create a filter for issues that contain the text
  1. Navigate to the Search issues page in Jira.
  2. Switch to Advanced JQL mode.
  3. Enter the following query, replacing "your text" with the phrase you want to exclude:
    text ~ "your text"
  4. Click Save as and give the new filter a descriptive name, such as "Contains - your text". 
Step 2: Query for issues that do not contain the text
  1. Navigate back to the main Search issues page.
  2. Switch to Advanced JQL mode.
  3. Enter the following query, replacing "Contains - your text" with the name of the filter you just created:
    filter != "Contains - your text"
    
  4. This will return all issues that did not match the initial filter, effectively showing you the issues where none of the comments contain the specified text. 
Greg Harder September 3, 2025

Oh, nice!  Thank you so much, I figured I was missing something like that.  Is that search behavior documented anywhere?  I'd like to know more about how JIRA searches for your exact queries.

Like John Funk likes this
Trudy Claspill
Community Champion
September 3, 2025

You're welcome

I don't know if it is explicitly documented that a search for text in (or not in) comments is applied to each comment. It might be inferred from the documentation where it says "Search for work items that have a comment that contains particular text..."

For more information about text searches in general you can follow the link the the paragraph about Comment field text searches.

Screenshot 2025-09-03 at 1.39.47 PM.png

https://support.atlassian.com/jira-software-cloud/docs/search-for-work-items-using-the-text-field/

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events