Forums

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

Automation: Customfield exactly matches regular expression

Thomas
Contributor
October 6, 2021

Hi all,

I am trying to include an "If" block in my automation to check whether a custom field (Text Field (single line)) starts with any of those strings:

Advanced compare condition

{{issue.customfield_10028}}

exactly matches regular expression

/^000|^ABC|^DEF|^HIJ|^KLM|^NOP|^QRS|^TUV/i

Somehow this never passes although the value in my customfield is e.g. ABC123Z34D.

Note: this match should be case insensitive which I think is covered by /i

What am I missing here?

Thanks for your help!

1 answer

1 accepted

6 votes
Answer accepted
Kian Stack Mumo Systems
Community Champion
October 6, 2021

@Thomas

I would change it to this -

 

(^000|^ABC|^DEF|^HIJ|^KLM|^NOP|^QRS|^TUV).*

Thomas
Contributor
October 6, 2021

Hm, appears not to pick it up.

I tried

(^000|^ABC|^DEF|^HIJ|^KLM|^NOP|^QRS|^TUV).*

and

/(^000|^ABC|^DEF|^HIJ|^KLM|^NOP|^QRS|^TUV).*/i

Kian Stack Mumo Systems
Community Champion
October 6, 2021

What is the exact value of the custom field you are trying to use this for?

Thomas
Contributor
October 6, 2021

It could be something like this:

00013F123d

ABC12345

Abc12345

abC12356

Those would all be valid.

Thomas
Contributor
October 7, 2021

I have now tried various combinations but none of them seem to work.

One issue came in with

customfield_10028 "0006ABCD"

so ^000 should have been a match but didnt.

I also changed the condition from "matches exactly" to "contains regular expression" but this does not make difference either.

I'm a bit lost to be honest :)

Like felix.weber likes this
Kian Stack Mumo Systems
Community Champion
October 7, 2021

Hmm, I'm using a "matches regex exactly.".

I did find an issue with casing, but when I amended it to this regex I didn't run into any more casing issues.

 

(?i)(^000|^ABC|^DEF|^HIJ|^KLM|^NOP|^QRS|^TUV).*
Like Thomas likes this
Thomas
Contributor
October 7, 2021

This appears to have done the trick! Thank you ever so much!

Suggest an answer

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

Atlassian Community Events