Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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 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
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

41 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you