Forums

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

Automation, lookup issues, and match function

Florian Beqiri November 20, 2025

Hello everyone,

I'm having a problem with one of my automations. I have vulnerability tickets that contain a paragraph field with different host names.

Now I want to go through this field with host names in an automation and count how many hosts that match a regex are contained in total.

But it just doesn't work. I think it's because of my wrong approach. 

 

have vulnerability tickets that contain a paragraph (multi-line) text field listing multiple hostnames, for example:


example-ce003.example.local, example-ce004.example.local, example-cf104.example.local, example-cf116.example.local

My goal is:

Go through this paragraph field in the automation and count how many hostnames match a certain regex pattern, such as:

 

example-cf*.example.local
The soltuion should be: 2
Unfortunately, match() hasn't worked so far.

Ultimately, I want to store the number of my results in a variable. For example, when I use log, the field of the field is displayed, but when I use size, match, or a function, nothing is displayed. Can anyone help me with the solution?

Best regards! 

 

3 answers

0 votes
Tudor Tofan
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.
November 20, 2025

Hi @Florian Beqiri !

I would go for a more simplistic approach:

If the texts is always of this format, I would use the split(",") function and then apply the size() function.

it would be something like this: issue.customfield.split(",").size

Florian Beqiri November 21, 2025

Hi,

But how do I get the number of values I need to search for?

Tudor Tofan
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.
November 21, 2025

Sorry, I thought that since you were mentioning "match()" that you already know about smart values. The formula above needs to be integrated between {{ and }}.

{{issue.customfield.split(",").size}}

You can either create a custom field to store the value, and then you need to have an "edit work item" action -> set value -> use the formula

Or, let's say you want to send an email with this information, you can use the formula as is in the email body. e.g. "this string contains {{issue.customfield.split(",").size}} hostnames"

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.
November 20, 2025

Hi @Florian Beqiri 

For a question like this, context is important for the community to help.  Please post the following:

  • what type of project is this: company-managed, team-managed, JPD, etc.
  • an image of your complete automation rule in a single image for continuity
  • images of any relevant actions / conditions / branches
  • an image of the audit log details showing the rule execution
  • explain what is not working as expected and why you believe that to be the case

Until we see those...

The automation match() function can have challenges with some field formatting and there is no documentation of what does (or does not) work with regex.  Instead, the doc only states the "underlying implementation is based on Java's Pattern class".  Experimentation is key to confirm what works, perhaps starting with a very simple expression, testing that, and incrementally adding edge cases.

Maybe try this as a start, using an example custom field ID:

{{issue.customfield_12345.replace("\n", " ").match("(example\-cf.*\.example\.local)").size|0}}

Please note the replacement of any newlines and adding escaping for characters that could be interpreted as reserved tokens in the expression.

That would be the total count. If you want the unique count, add a distinct function:

{{issue.customfield_12345.replace("\n", " ").match("(example\-cf.*\.example\.local)").distinct.size|0}}

 

Kind regards,
Bill

Florian Beqiri November 21, 2025

Hi,

I think that I cannot follow you. Could you please give me an example using lookupissues? 

Best regards,

Florian

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.
November 21, 2025

First thing: if you are having difficulty following that explanation, please pause to review these documentation pages before proceeding.  They will help you understand how rules, smart value lists, and the match() function will interact:

  1. https://www.atlassian.com/software/jira/guides/automation/overview#what-is-automation
  2. https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Lookup-issues
  3. https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/
  4. https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#match--

 

Next, the example I provided would work for a single work item.  The expression might be slightly different for a Lookup Work Items result...dependent upon what you are trying to do with that information.

Please post images of the following for context:

  • your entire rule in one single image for continuity
  • the action where you are trying to use the smart value expression
  • the audit log details showing the rule execution
  • explain what is not working as you expected

 

Like Florian Beqiri likes this
0 votes
Florian Beqiri November 20, 2025

A step by step solution would be really helpful! 

Suggest an answer

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

Atlassian Community Events