Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

JQL search for string with underscoere?

Benjamin Peikes January 15, 2019

How do you do a JQL search using the ~ operator for the literal string "NO_SOD"? When I try text ~ "NO_SOD" I get issues which have NO and/or SOD.

2 answers

0 votes
Davin Studer
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.
January 15, 2019

I have found that underscores and dashes tend to mess up searches. In fact there is a bug ticket for this JRASERVER-31882. If you have ScriptRunner you can do this ...

issueFunction in issueFieldMatch("", "summary", ".*NO_SOD.*")

Also according to JRASERVER-6218 Jira 8.0 will support regex searches natively so you should be able to do this soon-ish ...

summary ~ "/.*NO_SOD.*/"
Benjamin Peikes January 15, 2019

I won't hold my breath. Atlassian's work around is to recommend using ScriptRunner. I'm not sure why Atlassian doesn't just buy that company and integrate their tools directly into Jira.

Davin Studer
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.
January 15, 2019

Actually, I just re-read the second issue (JRASERVER-6218) and it looks like they had to back out regex searching in Jira 8.0. :( But if you happen to have ScriptRunner you could still do it that way.

0 votes
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2019

you need to do an exact match I believe. see if this document help - advanced-searching-operators-reference. I have had mixed luck w/ this TBH. if i get a minute I will give your UC a try.

Benjamin Peikes January 15, 2019

I've looked at the link you posted. Issue is that text ~ "NO\_SOD" is not valid. You get the error "Error in the JQL Query: '\_' is an illegal JQL escape sequence. The valid escape sequences are \', \", \t, \n, \r, \\, '\ ' and \uXXXX. (line 1, character 11)"

This seems like a bug. I'll probably report it to Atlassian so they can ignore it for 7 years.

Like # people like this
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2019

yep, like I said mixed luck for me too. it might be that I'm using incorrectly or just limitations. I will ping other champions to see if they want to test their Jedi-JQL skill on this. It wouldn't hurt to create a support ticket. While it may not result in a 'fix' maybe a clear answer which would be good to post back here.

Bastian Stehmann
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2019

Hi @Benjamin Peikes,

are you on cloud or on server?

I just tried this on server and I have one issue having only NO in the summary, one with SOD and one with NO_SOD.

If I search for summary ~ "NO_SOD" I get only the one issue with NO_SOD, also with text ~ "NO_SOD"

On Cloud, it behaves different.

I just created the same issues, and when I search for "NO_SOD", I get the issues with NO_SOD and SOD, but not the one with NO.

Kinda weird.

Just tried to search for "NO?SOD" and thought, there can be only one result, but I get a lot of different results, containing not even NO and/or SOD.

Maybe this is also related with https://jira.atlassian.com/browse/JSWCLOUD-16529

Bastian Stehmann
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2019

I just tried to search for NO?SOD on server, and there I don't get any result, so also not the expected behaviour :-(

Benjamin Peikes February 11, 2019

Bastian,

The issue you listed is unrelated, search works, it just treats "NO_SOD" as a search for anything with the words "NO" or "SOD". Basically, it's broken.

https://jira.atlassian.com/browse/JSWCLOUD-16529 

Like Alex Read likes this
Samarth S May 11, 2023

I know it's late but fwiw:
You can try:

summary~"\"NO_SOD\""

This behaves exactly as expected. 

Reference: https://jira.atlassian.com/browse/JRASERVER-14641
Read the comments in the above ticket

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events