Search code examples
jirajql

Jira jql search not working with special character '-' or '&'


I couldn't get jql to work properly in jira (my version: v.7.6.5)

Say if I have a field named location and here's the value for the location field:
Seattle - East

And when I search in jql with query:
location ~ "Seattle - East" nothing would come back.

Can anyone help with searching string with special characters such as - or &?

ps. I've read documents from Atlassian to escape characters with \ and \\ it doesn't seem to work well with &


Solution

  • I'm guessing that you're searching a custom text field named Location based on the operator.

    The search location ~ "Seattle - East" is searching for values that contain Seattle and do not contain East.

    To search for an exact phrase you confusingly need to have a nested set of double quotes: location ~ "\"Seattle - East\""

    I'm pretty sure that even in that scenario Jira will just ignore the -.

    Note that if you want more reliable reporting out of a custom field, a select list might be a better fit for a fixed number of location options. Then you could do a search like location = "Seattle - East"