Forums

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

How to Use Jira Regex Properly for Attachments?

Ian Guyette
Contributor
November 30, 2023

Hey Jira folks, I have a frustrating issue that's become quite the time-waster as of late. I would like to remove specific attachments from an issue when the status is changed. I have the trigger set properly, but the problem is that the attachments remain after I expect them to be deleted. 

The attachment identification is done via regex, noted as follows: Screenshot 2023-11-30 at 3.58.22 PM.png

So, if I wanted to remove forms called "Part 1", "Part 2", and "Part 3", I would simply put Part 1, Part 2, Part 3 into the regex field. Yet, the automation runs and detects nothing when said forms are attached to the issue. Anyone else run into this problem? 

 

1 answer

1 accepted

2 votes
Answer accepted
Ste Wright
Community Champion
November 30, 2023

Hi @Ian Guyette 

Is "Part 1" the full name? Or is it something like "Part 1.pdf"

You need the ".pdf" part also if yes.

So it would be...

Part 1.pdf,Part 2.pdf,Part 3.pdf

Ste

Ian Guyette
Contributor
December 1, 2023

Thanks Stephen, I was wondering about this and I'll elaborate a little further. 

 

The attachments do end up looking like that as PDFs on the issue. Further, they also have the date of the attachment added to them. This shouldn't be an issue, since regex can look for patterns to match, and I should be able to use a regex expression to search for "Part 5" within an attachment's name, but this has never yielded successful results. 

For instance, using: 

(?i)Part 5

Yields no results on an issue that has "Report (Part 5).pdf" as its name. The automation triggers when the issue closes, runs and reports a success for no actions performed, even though it really should be seeing this file and removing it. Very odd. 

Ian Guyette
Contributor
December 1, 2023

Turns out the regex has to match the filename exactly, so I needed to adjust the syntax. Thanks for the help!

Like Ste Wright likes this

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