Forums

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

How can I by JQL search for issues with question mark "?" in a text?

Mikael Kalla
Contributor
August 27, 2020

I have an automation that gets the last comment to a separate text field ("LastComment".

I want to create a JQL filter that gives me all issues where "LastComment" has a question mark "?" in the text.

But it looks like the "?" is a reserved character for wildcard, even if I surround it with quotes I don't get the result I want.

My JQL in my filter:   project = xx AND "Last Comment" ~ "'?'"

Any idea how I can solve this?

Thanks//Mikael

4 answers

0 votes
Ziad Bakhiet
Contributor
October 21, 2020

Hello Mikael,

You can get the result straight forward using JQL Search Extensions.

The JQL will look as following:

issue in wildcardMatch("LastComment", "*?*")

This JQL will match issues that contains "?" in the field "LastComment" 

The full documentation can be found here.

Regards,

Ziad

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 20, 2020

Hi Mikael,

I understand that you are trying to use Jira's JQL to find all the issues that contain a question mark '?', however is not as easy as it seems.  JQL does not have true string matching abilities.  But rather it is being restricted to full word and partial word searches.  This limitation is mentioned in Search syntax for text fields: Limitations.

That said, since we know you're using automation, there might be a way that you can use automation to flag these issues in a manner that JQL can report on them.   For example, I created an automation rule like so:

Screen Shot 2020-10-20 at 1.40.19 PM.png

In my example, I used the Advanced Compare condition that allows you to search using regex.  In my example, I had it look at the issue description for the regex of \? (which is any question mark in that description).  For my action I had it change the Priority field to be Highest, but you could easily create a new custom field of any type, but I'd suggest something like Checkbox.  You could then use automation to set this flag that can then be queried by JQL for other uses, such as dashboard or board filters to show particular issues elsewhere within Jira.

You could also tweak this to look at comments, and set a custom field on the issue based on the appearance of a particular character in that comment in much the same manner.  It looks like you found a similar work-around by changing the character into a complete word, but my approach has the benefit of not needing to alter the comment or description field to be able to see this in JQL.

I hope this helps.

Andy

0 votes
Mikael Kalla
Contributor
August 27, 2020

One ugly workaround that looks to be working, is that I have the automation
to "replace" the "?" character with a specific word, e.g "Question".

{{issue.comments.last.body.replace("?","? QUESTION")}}

Then all text with ...? will appear as ....? QUESTION

Based on that I then can make a filter with following query:

project = xx AND "Last Comment" ~ "QUESTION"

0 votes
Jira Guru
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 27, 2020

 

Hi @Mikael Kalla 

 

I am not sure ther is any field called last comment.

 

Try adding slashes in front of ? 

comment ~ "\\?"

Mikael Kalla
Contributor
August 27, 2020

Hi Guruvayurappan G R 

It's a custom field.

Automation takes the last comment and set that custom field with same text.

I've already tried the backslashes, but get no results in my filter query.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events