Remove images from attachments list

Stuart Ogle July 6, 2016

Hello,

Trialling Confluence for the business currently, which would be used for technical documentation. Some pages will have attachments e.g. scripts, that I would like to view using the attachments macro. However, the macro also shows all of the pictures embedded in the page too.

Is there a way to exclude pictures from the attachments macro? I have tried to use the regex filter ^.*png, but this still displays PNG images. Is there a regex expression that will achieve what I want?

Thank you for your help

Stuart

3 answers

2 votes
Bence Láposi March 24, 2018

Hi, sorry for necroing this thread, but you may try

^((?!\.png).)*$

as seen at https://bobswift.atlassian.net/wiki/spaces/info/pages/44695583/How+to+use+regular+expressions

If you want to hide all files that end with png (say maybe someone accidentally removes the dot before the file extension when renaming), then

^((?!png$).)*$

would be the expression.

Also the file extension might be in caps (PNG) but regex is usually case sensitive (on Confluence it is) so the final solution is

(?i)^((?!png$).)*$

where (?i) in front of expressions will make sure it searches for upper and lowercase variants too.

0 votes
Brandon Valley May 24, 2020

this will excude all forms of .jpg and .png files, read @Bence Láposi's  answer for a great explanation of how this works

 ((?i)^((?!(jpg|png)$).)*$)

also here's a link to the full documentation on this subject:  https://bobswift.atlassian.net/wiki/spaces/info/pages/44695583/How+to+use+regular+expressions

0 votes
Rodney Hughes
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.
July 6, 2016

try adding labels to the attachments via the Ellipsis (three dot icons)>Attachments

then set the type of labels in the Attachments macro

Stuart Ogle July 7, 2016

Hello,

Thank you for your reply.

A number of people will be updating the Wiki with information and potentially uploading files, so this solution isn't really suitable for our situation.

Thanks again

Stuart

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events