Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Searching Labels for string at end of label

larry joseph
Contributor
March 17, 2025

I want to find issues that have a label that ends in either GoLive or Tier1.  Issues will have labels like:  

  1. XYZGoLive
  2. XYZGoLiveTriage
  3. ABCTier1
  4. ABCTier1Stuff

I only want issues 1 and 3 back.  Issues can have multiple labels as long as one is ending in GoLive or Tier1.

 

We have scriptrunner and I tried

(issueFunction in issueFieldExactMatch('project in (myproject)', labels, '.*GoLive') or issueFunction in issueFieldExactMatch('project in (myproject)', labels, '.*Tier1'))

But this returns all 4 of the above.

 

I then added the $ at the end, but not it doesn't return any issues.

(issueFunction in issueFieldExactMatch('project in (myproject)', labels, '.*GoLive$') or issueFunction in issueFieldExactMatch('project in (Smyproject)', labels, '.*Tier1$'))

 

 

I've also tried with issueFieldMatch (instead of ExactMatch) but get the same results

Thanks

 

 

4 answers

1 accepted

1 vote
Answer accepted
larry joseph
Contributor
March 19, 2025

I was able to find a work around and we've contacted Scriptrunner to report as an issue.  It seems that it's concatenating the labels together separated by commas with some unknown character at the end.  To work around I used a , (comma) as part of search string to handle when the value was in a list of labels and used .$ to say any single character between what I'm searching for and the end of the list.

 

issueFunction in issueFieldMatch('project in (myproject) AND issuetype in (Epic, Story)', labels, '[a-zA-Z]GoLive.$|[a-zA-Z]GoLive,|[a-zA-Z]Tier1.$|[a-zA-Z]Tier1,')

2 votes
Richard Cho - ServiceRocket
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 17, 2025 edited

@larry joseph can you try this? I don't have a DC instance to test but this works for me in Jira Cloud.

issueFunction in issueFieldExactMatch('project in (myproject)', labels, '\w*(GoLive|Tier1)$')
larry joseph
Contributor
March 18, 2025

Thanks, testing this and so far it's not working. I had to change '\w*(GoLive|Tier1)$' to '\\w*(GoLive|Tier1)$'.   But this doesn't return any results.  It seems like it's treating the labels as a comma separated list with some unknown final delimiter.  Whenever I use the $ I get nothing back.  Will keep testing and reply back if I get anything working.

 

0 votes
Hannes Obweger - JXL for Jira
Atlassian Partner
March 18, 2025

Hi @larry joseph

if you're open to other solutions from the Atlassian Marketplace, this would be easy to do using the app that my team and I are working on: JXL for Jira.

JXL is a full-fledged spreadsheet/table view for your issues that allows viewing, inline-editing, sorting, and filtering by all your issue fields, much like you’d do in e.g. Excel or Google Sheets. It also comes with a long list of advanced features, including support for (configurable) issue hierarchiesissue grouping by any issue field(s), sum-ups, or conditional formatting - as well as the ability to filter issues via regular expressions

With regular-expression-based filtering, you can apply pretty much any logic, including the one that you are after:

regex-filtering-labels-suffix.gif

In your case, this regular expression should work:

.+(GoLive|Tier1)

Once you've identified your issues, you can work on them directly in JXL (e.g., bulk edit them via copy/paste), or trigger various operations in Jira.

Any questions just let me know,

Best,

Hannes

larry joseph
Contributor
March 18, 2025

Thank you for the suggestion.  We are set for now on the plugins, but will keep this in mind for the future.

Like • Hannes Obweger - JXL for Jira likes this
0 votes
larry joseph
Contributor
March 17, 2025

Doing a little more digging it seems like it's seeing the labels as a comma separated list so if something has more than one label it won't search the expected way, as the regular expression I have assumes it was looking label by label.  Any suggestions???

Suggest an answer

Log in or Sign up to answer