Forums

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

Automation: Creating a Variable with RegEx and using it inside another fuction

Ludwig Einicke
August 28, 2026

Hello dear Atlassian-Community,

I am currently trying to build something that would make an old automation of mine way shorter and incredibly more efficient, but the whole idea hinges on "being able to create a RegEx dynamically and handing it over to another function"

Here is the functional part of my concept:

0) Trigger: Doesn't matter for this case

1) Action: Create Variable

This is a comma separated gathering of calculations done beforehand.

Name: myVarInput
Value: 1~A, 111~B, 1~C, 11~D

Worth noting: "More 1 = more important" I would want to get "B" back in some way and i thought of trying with regEx.

2) Action: Create Variable

Name: maxOnesMinusOne
Value: 2

We will not talk about how I will get the max size / maximum numbers of "1"s from {{myVarInput}} here and subtract 1 - lets just assume I get the Value 2 somehow ;)

2) Action: Create Variable

Name: myDynamicBlock
Value: [1]\{1,{{maxOnesMinusOne}}\}

Note: I would want to have the output [1]{1,2} for our example input

3) Action: Create Variable

Name: regExTest
Value: {{myVar.replace(myDynamicBlock,"0")}}

Note: I would want to have the output "0~A, 01~B, 0~C, 0~D" here. Next step would be {{regExTest.split(", ").remove("0~.*")}} to have only the most important (multiple possible) entries left.

 

Questions:

1) Is the handover from maxSizeMinusOne to myDynamicBlock possible (can i exclude curly brackets somehow)?

2) Is the handover from myDynamicBlock to regExTest possible? (how do i get it to execute properly)

 

Edit/carifications:

- {{myVarInput}} is vastly reduced in complexity and simply gauging the size of the individual chunks separated by commas will not work in the real world application.

- I have corrected some spelling/consistency mistakes after posting

 

Kind regards,

Ludwig

0 answers

Suggest an answer

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

Atlassian Community Events