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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,560,447
Community Members
 
Community Events
185
Community Groups

why is issueFieldExactMatch() not working with any regex?

Edited

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

1 answer

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Dec 19, 2019

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

Like Andy Heinzer likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events