Forums

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

.match() function suddenly not working

Brock Jolet
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.
September 25, 2025

I built an Automation rule a while back that allows certain people to manually trigger a request to transition an issue to a hidden status if it's already linked to another issue.

 

The basic setup is as follows:

  • User triggers rule
  • The user is asked to provide a text input which gets stored as {{userInputs.ticketNum}}
  • I then parsed the input for a ticket number and saved it as a variable called {{ticketNum}} using this smart value: {{userInputs.ticketNum.upperCase.match("([A-Z]+-\d+)")}}
    • That forced all caps and stripped anything not matching the correct ticket format so that users could copy and paste a URL for example.
  • I then used an If/Else block to verify that {{ticketNum}} matched the regex 

    [A-Z]+-\d+

  • If correct, I would proceed to transition the issue as requested.

 

This worked for some time, but wasn't used often. It looks like it was last successfully executed on 2025-08-14. At some point between then and today, it stopped working.

 

Doing some testing, I learned that any use of .upperCase now returns a blank value and similarly .match() also returns a blank value. Thankfully, I was able to find .toUpperCase() as an alternative that works, but there is no alternative to .match().

 

I tried passing the raw input to my If/Else block and can confirm that the regex is correct. However, I need a method of stripping the extraneous parts of the string so that I can pass the key into a Lookup.

2 answers

1 accepted

1 vote
Answer accepted
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.
September 25, 2025

Hi @Brock Jolet 

Without seeing your entire rule and audit log details...

I hypothesize the problem is any extra characters you do not want to match upon are not handled with the regular expression passed to the match() function.  Perhaps try adding some tokens outside of the selection, writing the results to the audit log for testing, such as:

{{userInputs.ticketNum.trim().toUpperCase().match("^.*([A-Z]+-\d+).*")}}

 

And as a reminder, there is no automation documentation for what actually is (or is not) supported for regular expressions in automation rules, and so experimentation is required.  What the docs say, with emphasis added by me, is:

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. If multiple matches are found, they return as a collection that can be iterated...

 

Kind regards,
Bill

Brock Jolet
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.
September 25, 2025

Thanks for this suggestion, @Bill Sheboy . Using your smart value, I didn't get the full issue key, but I did get part of it, which is better than a blank result. So, this implies a problem with the regex after all as opposed to a blanket issue with .match()

 

I'm going to try more digging to see how far I can get.

Brock Jolet
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.
September 25, 2025

I think I've got it working with this smart value.

{{userInputs.ticketNum.trim().toUpperCase().match(".*?([A-Z]{2,}-\\d+).*")}}


I must have been compounding issues somehow when testing .match() previously.

Thanks for your help! 

Like Bill Sheboy likes this
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.
September 25, 2025

Well done!

Every time I see a question like this, I plan to create a test rule to exercise regex expressions in different contexts, and leave it running on a schedule as a "canary" to detect any changes.  Then I forget about it...and it goes to the bottom of the experiment priorities :^)  I'll make an index card for it this time to remember.

Like Brock Jolet likes this
1 vote
John Funk
Community Champion
September 25, 2025

Hi Brock,

I suggest you go ahead and open a support ticket with Atlassian while you are waiting on other responses. It won't hurt and might get your answer quicker in the long run, especially if there is some type of bug that has been introduced. 

https://support.atlassian.com/contact/#/

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