---
title: "Regular Expressions"
manual: "secure_downloads"
version: "main"
permalink: "https://docs.typo3.org/permalink/leuchtfeuer/secure-downloads:admin-regularexpressions@main"
source: "Admin/RegularExpressions/Index.rst"
rendered: "2026-09-22T10:54:01+00:00"
---

# Regular Expressions {#admin-regularexpressions}

The configuration values of [securedDirs](https://docs.typo3.org/permalink/leuchtfeuer/secure-downloads:admin-extensionconfiguration-secureddirs@main), [securedFiletypes](https://docs.typo3.org/permalink/leuchtfeuer/secure-downloads:admin-extensionconfiguration-securedfiletypes@main),
[forcedownloadtype](https://docs.typo3.org/permalink/leuchtfeuer/secure-downloads:admin-extensionconfiguration-forcedownloadtype@main) and [groupCheckDirs](https://docs.typo3.org/permalink/leuchtfeuer/secure-downloads:admin-extensionconfiguration-groupcheckdirs@main) allow regular
expressions. All expressions will be handled case insensitive.

> [!TIP]
> **Hint**
>
> The slash character `(/)` is automatically quoted for your convenience.

## Examples {#admin-regularexpressions-examples}

The following are a few examples of the [securedDirs](https://docs.typo3.org/permalink/leuchtfeuer/secure-downloads:admin-extensionconfiguration-secureddirs@main) configuration option:

For example, if you need to secure the `fileadmin` and the `typo3temp` directory, but not an uploads directory, you can simply
write:

```php
fileadmin|typo3temp

```

To secure files underneath of `fileadmin/secure` or `typo3temp`, you need to write:

```php
fileadmin/secure|typo3temp

```

You also can group some elements with regular expression, but you should be careful with grouping, because complex regular
expressions in the extension does not work if some other matches occur by the expression.

For grouping  `( )` is used, but in our case you need to exclude the result of this `( )`. This can be done with
`(?: )`

For example, we want to secure files underneath `fileadmin/secure1`, `fileadmin/secure2`, `fileadmin/secure3` and typo3temp:

```php
fileadmin/secure(?:1|2|3)|typo3temp

```

You can achive the same result be using square brackets `[ ]`, but keep in mind that all characters between the brackets are allowed here:

```php
fileadmin/secure[123]|typo3temp

```

If you need to exclude some subdirectories within a secured directory, you can use the Elvis Operator `(?! )`:

```php
(?!fileadmin/unsecured)fileadmin

```

Last but not least, you can store all your protected files within different subdirectories having the same name. In this example
we use "secure" as directory name:

```php
fileadmin/(.*)/secure

```

This will secure files within `fileadmin/foo/secure` and also within `fileadmin/bar/secure`.

> [!TIP]
> **Hint**
>
> More information can be found here: [http://www.regular-expressions.info](http://www.regular-expressions.info)
