---
title: "How to use regex expressions to select attachments - Cloud"
canonical: "https://support.appfire.com/space/TBL/74812136/How%20to%20use%20regex%20expressions%20to%20select%20attachments%20-%20Cloud"
format: markdown
---
> Macro (aura-html)

# <span style="color: #000000">Overview</span>

<span style="color: #000000">This page demonstrates how to use the</span> [Attachment Table macro](https://appfire.atlassian.net/wiki/spaces/TBL/pages/74812217)<span style="color: #000000">, which is part of the</span> [Advanced Tables for Confluence](https://appfire.atlassian.net/wiki/spaces/TBL) <span style="color: #000000">app, to select attachments based on the space or attachment name using a regex expression.</span>

- <span style="color: #000000">Use the special </span><span style="color: #000000">*@self*</span><span style="color: #000000"> value for the </span><span style="color: #000000">*Space key or space name regex*</span><span style="color: #000000"> parameter to match on all attachments in the current space.</span>
- <span style="color: #000000">Use </span><span style="color: #000000">*.*png*</span><span style="color: #000000"> to match on attachments whose name ends in PNG.</span>

# <span style="color: #000000">Macro browser input</span>

### <span style="color: #000000">Select this macro</span>

|  |  |
| --- | --- |
| <span style="color: #000000">**Macro name**</span> | <span style="color: #000000">*Advanced Tables - Attachment table*</span> |
| <span style="color: #000000">**Macro syntax (Old editor)**</span> | <span style="color: #000000">*{attachment-table}*</span> |
| <span style="color: #000000">**Macro syntax (New editor - case insensitive)**</span> | <span style="color: #000000">*/Attachment Table*</span> |

### <span style="color: #000000">Define these parameters/values</span>

|  |  |
| --- | --- |
| <span style="color: #000000">*Space key or space name regex*</span> | <span style="color: #000000"> </span><span style="color: #000000">*@self*</span> |
| <span style="color: #000000">*Attachment name regex*</span> | <span style="color: #000000">.*png</span> |

> ℹ️ <span style="color: #000000">Confluence is more limited on parameter values. Thus, </span><span style="color: #000000">**| **</span><span style="color: #000000">(pipe - used for regex </span><span style="color: #000000">**or**</span><span style="color: #000000">)</span><span style="color: #000000">** **</span><span style="color: #000000">is a reserved character and cannot be used.</span>

### <span style="color: #000000">Parameters set in the macro editor</span>

![Advanced Tables Attachment Table macro regex selection settings](media://79b79f17-7bb7-4330-8f34-4f751e2cf90b)

![Advanced Tables Attachment Table macro regex output settings](media://7b5cc8cf-05d6-4382-8455-24117e9c0971)

# Wiki markup input (Old editor)

```plaintext
{attachment-table:spaceRegex=@self|attachmentRegex=.*png} 
```

# Example result

![Advanced Tables attachment table example for a space using regex selection](media://7457085d-9f40-4c5e-8282-619212c815f4)

> ✅ ### Selecting attachments based on matching on more than one label
> ✅ 
> ✅ <span style="color: #000000">Constructing a regex to match attachments that have two or more specific labels is a bit more complicated. To do this, you must:</span>
> ✅ 
> ✅ 1. <span style="color: #000000">Set the </span><span style="color: #000000">*Label match option*</span><span style="color: #000000"> to </span><span style="color: #000000">*all*</span><span style="color: #000000">.</span>
> ✅ 2. <span style="color: #000000">Use a regex pattern similar to the following using </span><span style="color: #000000">*xxx*</span><span style="color: #000000">, </span><span style="color: #000000">*yyy*</span><span style="color: #000000">, and </span><span style="color: #000000">*zzz*</span><span style="color: #000000"> as sample labels:</span>
> ✅ 
> ✅ ```
> ✅ 2 labels:  .*(?:.*\b(?:(?:xxx)|(?:yyy))\b.*){2}.*
> ✅ 3 labels:  .*(?:.*\b(?:(?:xxx)|(?:yyy)|(?:zzz))\b.*){3}.*
> ✅ ```

# <span style="color: #000000">Other examples</span>

<span style="color: #000000">Visit our</span> [full list of product examples](https://appfire.atlassian.net/wiki/spaces/TBL/pages/74814716) <span style="color: #000000">for additional inspiration!</span>