How to search for labels with a wildcard?

Hi!

Can anyone tell me how I can search for all labels containing a certain word?

I've tried:

labels = "word*" brings no result

labels ~ "word*" brings massage "is not supported by the field labels"

I want to be able to build filters for groups of labels, i.e. "linux-*", "macos* etc.

Thanks,

Nica

7 answers

Try the "issueFieldExactMatch" JQL Function from Script Runner plugin.

issueFieldExactMatch (subquery, fieldname, regexp)

Here's an example for searching labels:

issueFunction in issueFieldMatch("reporter = fred", "labels", "ie[8|9]")

This will locate my labels "ie8" and "ie9" but not give matches against "ie7" or "review" (etc)

Hi Mark,

can this issueFunction be used for identifying issues with labels starting with a specifies string "c/"?

I am using query

issueFunction in issueFieldMatch("", labels, "c/.*")

but I also get results where labels dont start with but only include the required string (e.g. "asc/something")

Can you please advise?

Thanks,

Ondrej

@Ondrej, you might be able to use a regex "^" start of line anchor, i.e. "^c/.*" to do what you want. Sadly this only really works if you have only one label, or you c/ label is the first label.

TLDR: Try '\\bc/.*' Use 'word boundaries' rather than 'start of line'. Following up on Mark's comment, the workaround is to use the word boundary pattern rather than the 'start of line/input' pattern. The labels field is treated as a string containing the list's elements, which is why the start of line pattern isn't matching what you'd hope. See here for more useful patterns: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

Yes, that has happened to me twice in the past 2 or 3 months. I like JIRA and the plug-in approach. What I don't like is that the cost of all the plugins is starting to approach the cost of JIRA itself.

0 vote

Hi Nica,

You can see how to use wild cards in JIRA in this page, however, I believe this will only work if the JIRA Indexing Language is set to other due to word stemming. You can see more about this in this other thread. If possible, try to set the indexing language to 'Other' in the General Configuration and re-index JIRA. Then, try to use wildcards again.

I hope this helps! :)

Cheers,
Matheus Fernandes

It took me some time to try this, because I had to re-index which I can only do outside of office hours...

But: nothing. I switched the indexing language to other and re-indexed. The results of my search are the same as described above.

I could really use wirdcards too and the above suggestion didn't help me either. I've been using labels (tags) on other sites like Delicious and Flickr for many years and have developed a basic hierarchy to my tags. E.g. Actor:PM, Actor:Client, Value:Client_Engagement etc. I want to be able to search for all labels that start "X:" but without a wildcard that seems impossible in Jira.

I've started helping myself with custom fields instead, but that can't be the answer...

I could really use this too! I just assumed I could use wildcards on labels but was disappointed to find it didn't work. I guess I can create an 'or' query that matches all the known label forms that the regex would match. I'll have to update it whenever a new label is created, but it's better than nothing...

this is great to know! i just got this same question from my users and here is the answer posted only 9 hrs ago.

I'm glad the answer was useful. Just be aware that the "Scripted JQL Functions" module in Script Runner may go commercial at some point.

It's possible to search for labels using wildcards in JIRA only with addons, please give a try to following one Advanced Labels Search Plugin for Jira

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

147 views 1 17
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you