Forums

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

Search string that does not contain '---'

Roman Tarakanov
Contributor
May 3, 2018

I have a custom string field (summary) for my issues and would like to create a search that would show all issues where this field does not start with '---'.

I've tried the following:

summary !~ "---" - Unable to parse the text '---' for field 'summary'.

summary !~ "\-\-\-" - Error in the JQL Query: '\-' is an illegal JQL escape sequence.

summary !~ "\\-\\-\\-" - still shows all results

 

I'm guessing this is because '-' is a special character, which I can't escape for some reason; could someone point me in the right direction?

Jira version is  6.4.12

Thanks

1 answer

0 votes
Randy
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.
May 4, 2018

Jira doesnt support the startsWith operator or searching for dashes.

 

If you have SR, you can use issueFieldMatch to search for fields that starts with some text. Not sure if it supports searching for dashes though.

 

https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_issuefieldmatch

Roman Tarakanov
Contributor
May 4, 2018

Is there a list of special characters that cannot be used in the search?

So far I've tried '~', '@', '#', '$', '%', '^', '&', '-', '+', '=' none of which work

Randy
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.
May 4, 2018

Restricted words and characters are listed here:

https://confluence.atlassian.com/jiracoreserver073/advanced-searching-861257209.html#Advancedsearching-restrictionsRestrictedwordsandcharacters

You'll notice that there's no mention of "-" since it falls outside of the list of restricted characters and accepted characters (if it were officially restricted, you'd be able to escape to search on it)

Roman Tarakanov
Contributor
May 4, 2018

yeah, I've found that page and also this one:

https://confluence.atlassian.com/jiracoreserver073/search-syntax-for-text-fields-861257223.html

Their example (present in both pages) simply does not work

summary ~ "\\[example\\]"

is actually equivalent to

summary ~ "example"

which does not work for me at all :(

I guess they strip all the non alphanumeric characters from the search when ~ operator is used, ie there is no way to do what I want

[Edit] This is actually a known bug - JRASERVER-66244

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events