Forums

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

Automation rule not capturing label value using match() with colon in regex

Daphne Casal October 21, 2025

Hi everyone,

I’m setting up an automation rule to automatically link related issues between two projects — a team-managed (MIP) and a company-managed (MPD) project.

Each issue has a label in the format ws:<stream>, for example:

ws:branding 
ws:dns
ws:integration

In my rule, I’m iterating over all MIP child issues under an epic, and I want to extract the ws: label from each issue to find its matching MPD issue (with the same label).

Here’s the relevant part of my rule:

  • Branch: parent = "{{userInputs.mipEpicKey}}"

  • Create variable:

{{issue.labels.join(",").match("(ws:[^,\\s]+)").first}}

Log:

Found wsLabel={{wsLabel}} on {{issue.key}}

However, in the audit log, the wsLabel variable is always empty:

Found wsLabel: for MIP-123
Found wsLabel: for MIP-234
Found wsLabel: for MIP-345

All these issues definitely have labels, so I’m confident the data is there.

I also tried escaping the colon like this:

{{issue.labels.join(",").match("(ws\\:[^,\\s]+)").first}}

but it still returns nothing.

 What I’ve checked 

  • Confirmed {{issue.labels}} returns all labels (it does).

  • Tried contains("ws:") and that works, but I need the exact match (e.g. ws:branding).

  • Tried several variants of the regex (ws:.*, ws\\:.*, etc.).

  • The rule scope includes both projects.

 Question

Has anyone successfully used match() in Automation for Jira with labels that include a colon (:)?

If so, what regex syntax or workaround did you use to extract the label value?

The end goal is to use that ws: label in a Lookup Issues JQL, e.g.:

parent = "{{userInputs.mpdEpicKey}}" AND labels in ("{{wsLabel}}")

Any help or examples would be appreciated!

Thanks,

Daphne

2 answers

1 accepted

1 vote
Answer accepted
Christos Markoulatos
Community Champion
October 21, 2025

Hey Dafny

I tried the below and worked for me, check it out:

Test Rule

  • Trigger: Manual
  • Actions:
    1. Log:
      Labels raw: {{issue.labels}}
    2. Create variable:
      Name: wsLabel Value: {{issue.labels.join(" ").replace("^.*\b(ws:[A-Za-z0-9._-]+)\b.*$","$1")}}
    3. Log:
      Matched wsLabel: {{wsLabel}}

 Screenshot 2025-10-22 091660.png

Result

Audit log showed:

Labels raw: ws:branding

Matched wsLabel: ws:branding

Screenshot 2025-10-22 092255.png

Hope this helps!

Daphne Casal October 22, 2025

Hi Christos,

Thanks so much for the prompt reply and the detailed example! I set mine up exactly the same way, including the labelsNormalized variable and the same .replace() expression.

 

Each of my tickets has a few labels but only one ws: label (for example: customer-implementation org-acme parent team:cs ws:branding). When the rule runs, the log still shows all labels instead of just the ws: one:

Found wsLabel: customer-implementation org-acme parent team:cs ws:branding

Because of that, the lookup step doesn't find a match in the MPD project, so nothing gets linked.

parent = "{{userInputs.mpdEpicKey}}" AND labels = "{{wsLabel}}"

Here is a screenshot of my current rule setup and the audit log. Any ideas why it's still returning the full label list instead of just the ws: one?

image.pngimage.pngimage.png

Christos Markoulatos
Community Champion
October 23, 2025

Hey @Daphne Casal 

You are right, it needed more checking, regex has its own mind

try this in the variable:

{{issue.labels.join(" ").replaceAll("^"," ").replaceAll("\\sws:","|ws:").replaceAll("\\s[^|]+","").replaceAll("\\|",",").replaceAll("^,|,$","").replaceAll(",{2,}",",").trim}}

worked for me in many combinations in Labels

 

Log
Labels raw: VIP, promotion, ws:branding, ws:sales Labels joined: VIP promotion ws:branding ws:sales Labels JSON: "VIP", "promotion", "ws:branding", "ws:sales"
Log
joined = VIP promotion ws:branding ws:sales after mark = VIP promotion ws:branding ws:sales
Log
Matched wsLabels: ws:branding,ws:sales
Daphne Casal October 23, 2025

Hi @Christos Markoulatos , this definitely worked on my use case. Thanks for the help!

Like Christos Markoulatos likes this
Christos Markoulatos
Community Champion
October 23, 2025

happy to help @Daphne Casal

Keep rocking!

0 votes
Bill Sheboy
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.
October 23, 2025

Hi @Daphne Casal 

First things first: there is no documentation on what is (or is not) supported for regular expressions used by automation rules.  Instead, it states the following, with emphasis added by me in italics:

match()

Performs a regular expression search and returns the first (and only one) matching regular expression group.

The underlying implementation is based on Java's Pattern class and uses Matcher.find() to find matches...

There are many community posts indicating regex that works in other contexts does not work in rules.  Thus, I recommend using the simplest expression that can possibly work, always experimenting to validate, and then incrementally adding any edge cases.  And for complex regex, try storing that in a created variable before using it in a match() or replaceAll() function.

 

Back to your question, as the Labels field is a list, you may use this expression to find any matching labels which start with "ws:"

{{issue.labels.match("^(ws:.*)")}}

That will produce a list as a result.  If you first want to test for the existence of any values, check the list size is greater than 0.  You described expected one-and-only-one value, so perhaps compare to 1.

  • smart values condition
    • first value: {{issue.labels.match("^(ws:.*)").size|0}}
    • condition: equals
    • second value: 1

Then to get that exact single value, use the first function:

{{issue.labels.match("^(ws:.*)").first}}

 

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events