Hi,
One of our users has entered an incorrect-cased label in Jira, which is causing havoc with the filters we use, and confusion on which label is correct. I'd like to do a case-sensitive search so I can pull up the incorrect field and change all those labels to the correct one. This way, we can delete the incorrect label so it's not used in future.
Basically I need to know how to search on 'tech' so I get 'tech' results and not 'Tech' results.
Can this be done?
-Jen
If you happen to have the ScriptRunner app installed, you can do regex, and thus case-sensitive, searching, like this:
issueFunction in issueFieldMatch("labels is not empty",labels,"tech")
or, if you (or someone you work with) has access to the database, you can run the following query:
SELECT project.pkey,issuenum,label
FROM label
JOIN jiraissue on jiraissue.ID = label.issue
JOIN project on project.ID = jiraissue.project
where BINARY label = 'tech'
ORDER BY pkey,issuenum
Ah! Finally I can say thank you, Payne! Apparently the IE browser (our work default) won't let me reply - it only allows me to mark the answer as accepted. Switching to Chrome opens up the reply field.
It looks like we don't have ScriptRunner installed, as the search didn't work for me, but I'll see if I can get a database person to try the second option you suggested.
Thanks again for your help, and for the quick reply!
-Jen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Payne ,
I need to use issueFieldExactMatch method in my JQL, but I need to perform case insensitive search.
Could you please help me with any regex for that
Best 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 can use the (?i) directive, like this:
issueFunction in issueFieldMatch("labels is not empty",labels,"(?i)tech")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Payne ,
Thanks for your reply.
It works but, I it gives match, not exact match. If we search for "tech", it will give results as "Tech", "Technology", "TECHNO", "tech"
But I want exact match i.e if we search for "tech", it should give results as "tech", "Tech", "TECH".
Could you please help me with that.
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.
\b denotes word boundary in regex, so you can surround a string with it to search for a whole word only. You'll need to use double backslashes in JQL, i.e.
issueFunction in issueFieldMatch("labels is not empty",labels,"(?i)\\btech\\b")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Payne ,
issueFunction in issueFieldMatch("labels is not empty",labels,"(?i)\\btech\\b")
does not give any results.
Using
issueFunction in issueFieldMatch("labels is not empty",labels,"(?i)\\bbtech\\b")
gives results, but that does not give exact results either.
Thanks for the response.
Best 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.
Hmm, I verfiy that it works exactly as expected for me. Another thought is that since you're performing a case-insensitive match, you don't need to use the regex capability offered by issueFieldMatch; just perform a normal search, like this:
labels = tech
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Payne ,
JQL:
issueFunction in issueFieldMatch("project = ABC and issuetype = "DE", "Summary", "^(?i)Test$")
and for groovy:
issueFunction in issueFieldMatch("project = ABC" and key != ${issue.key}", "Summary", "^(?i)${summary}\$")
works fine for me.
Thanks a lot for your response.
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.
Narrow down the initial search as much as possible for best ScriptRunner performance. Especially, don't just go for "labels IS NOT EMPTY", but do the case-insensitive search here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The first answer will kill your system (first, find every ticket with any label, and then check for the target). Don't ask me how I know.
Try this instead, find case-insensitive and then from those find the lower-case:
issueFunction in issueFieldMatch("labels in (sphere)", labels, sphere) ORDER BY created DESC
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you happen to have the ScriptRunner app installed, you can do regex.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Another note about using issueFieldMatch and some other ScriptRunner JQL functions - the first argument is a subquery; for performance reasons, make it as restricted as possible, so that the remainder of the function has fewer issues to scrutinize. For example, you may can limit the search to a particular project, date range, etc. like this:
issueFunction in issueFieldMatch("project = BR and created > startOfYear()",field,regex)
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.
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.