I need to perform EXACT search. I am using below query:
issueFunction in issueFieldExactMatch("project = ABC and issuetype=DE", "summary", "FGH")
and it is returning correctly the issues with summary "FGH", but I want to list issues with summary "fgh" also.
I cannot use issueFieldMatch() because that would give results with nearby values as well like "fghij" or "ABCFGH".
I need to perform exact search but it should be case-INsensitive.
Also, any search with regular expression in issueFieldExactMatch() is not working, I do not uderstand why is that. As per documentation
below JQL should work:
issueFunction in issueFieldExactMatch("project = ABC and issuetype = DE", "Summary", "^T.st$")
I have issue with Summary "Test" but it is not giving any results.
Kindly help
Regards,
Swapnil Srivastav
Hi Swapnil,
I see that you are using the scriptrunner plugin for Jira, and trying to use the issueFieldExactMatch JQL scripted function, but this is not behaving as you expect. The link you cited though is a very old version of the documentation for that plugin, please see an updated version over at https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_issuefieldexactmatch
From that page:
Previously it was incorrectly documented that it was for an exact regex match, and may have even behaved like that. This was a bug.
Because this function had this previous bug, there are a number of misconceptions over its intended behavior vs actual behavior. Because of that I think would be preferable to use the other function, issueFieldMatch() instead and still get back the results you want here (ie case insensitivity). I think we can overcome the problems you mentioned previously here with that function. Try this query instead:
issueFunction in issueFieldMatch('project=ABC and type=DE','Summary','[Ff][Gg][Hh]\\b')
This is one way to search for the word 'fgh' and 'FGH' (as well as 'FgH' among others). The use of the \b makes this a word boundary search, so it won't include anything strings that might go beyond such as 'fghijk'. For use in JQL searching we have to double escape the slash here though into '\\b' or else JQL won't accept it.
That said the better approach here is to tell the scriptrunner regex parser to turn off the case-sensitivity rather than brute force all the combinations. We can do that by starting our regex with the switch of (?i). So you can make another query such as
issueFunction in issueFieldMatch('project=ABC and type=DE', 'Summary', '(?i)fgh\\b')
This does the same as the above, just in a slightly different way and makes it much easier than duplicating both cases for each character. Which is a much better way for searching for specific words in a summary, and not just word fragments which can happen a lot for short regex strings.
I hope this helps. Let me know if you have any questions about this.
Andy
Hello @Andy Heinzer ,
Thank you for the response.
I tried using the query you suggested, but it is not working as expected.
Using:
issueFunction in issueFieldMatch('project=ABC and type=DE', 'Summary', '(?i)fgh\\b')
returns all the possible matches i.e. ABCFGH as well as FGH ABC and fgh.
I got it working using:
issueFunction in issueFieldMatch('project=ABC and type=DE', 'Summary', '^(?i)fgh$').
Thanks and Regards,
Swapnil Srivastav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.