# Regular Expressions

> Running Regex101 unit tests against the regex engine Radarr and Sonarr use.

A page from the Profilarr documentation by https://github.com/santiagosayshey, last updated 2026-10-01 (commit: https://github.com/Dictionarry-Hub/profilarr.com/commit/92a5c54a149c3c94cd38a300e6082dc70a368f93). Web version: https://profilarr.com/test/regular-expressions. Edit on GitHub: https://github.com/Dictionarry-Hub/profilarr.com/edit/develop/src/routes/(docs)/test/regular-expressions/+page.svx

Profilarr doesn't have its own test editor for regular expressions. Instead, tests live on [regex101.com](https://regex101.com/), where you insert a pattern and add releases that should and shouldn't match. Paste its Regex101 ID into the expression in Profilarr, and Profilarr fetches the tests, runs each one through the [parser](https://profilarr.com/installation#the-parser), and shows which passed.

A `regex101` entry needs a regex flavor (`1`), your pattern (`2`), and at least one test (`3`), each with a test string and whether it should match (`4`), saved as a version you can link (`5`):

![A regex101 entry for a 3D release pattern, with five numbered labels: the .NET flavor in the sidebar, the Regular Expression box, the add button beside Unit Tests, the first test expanded to show its description, the test string 2026.3D, and an assertion that the regex does match, and the current version in the sidebar.](https://profilarr.com/images/docs_regex_testing_regex101[style=light].png)

The unit tests for Dictionarry's 3D regular expression, which identifies 3D releases.

> **Info:** Set these two options so regex101 matches the same way Radarr and Sonarr do:
>
> - **Flavor**: the engine regex101 tests with. Engines differ in the syntax they support, so a pattern can pass in one and fail in another. Pick `.NET`, because Radarr and Sonarr are written in C# and match with the .NET engine.
> - **Flags**: options that change how a pattern matches. Turn on `i`, which makes matching case insensitive, because Radarr and Sonarr ignore case when they match release titles.

## Writing Tests

Let's walk through adding the tests from the DTS example on the [Test](https://profilarr.com/test) page. The expression should match lossless DTS, and there are four releases to check it against.

Open a new entry on regex101, set the flavor and flag, and enter the pattern `DTS-HD(?![ .-]?HRA)`, which matches `DTS-HD` unless `HRA` follows it. Then, for each release, press `+` beside Unit Tests, paste the release into the test string, add the description, and set the assertion. [Open the finished entry](https://regex101.com/r/LDsZXA/1/unit-tests) to see it for yourself.

![A regex101 entry with the pattern DTS-HD(?![ .-]?HRA), the .NET flavor, and the i flag, and four passing unit tests: the DTS-HD.MA and DTS-HD releases assert that the regex does match, and the DTS-HD.HRA and plain DTS releases assert that it does not match.](https://profilarr.com/images/docs_regex_testing_dts[style=light].png)

The four releases from the DTS example as unit tests, all passing.

> **Info:** Don't try to test every release you can think of. Add the ones you've actually seen and care about. The same goes for the pattern: a simple one you'll still understand in a month that catches 95% of releases is better than a complex one that catches 99% but that you won't be able to read tomorrow.

## Saving Tests

Open **Save & Share** at the top left of regex101 and save the entry. Copy its access link, like `https://regex101.com/r/LDsZXA/1`, and paste it into the Regex101 ID field of the [regular expression](https://profilarr.com/build/regular-expressions) in Profilarr. Profilarr keeps just the ID and version, `LDsZXA/1`, and shows the results under Unit Tests.

![Profilarr's New Regular Expression page for DTS Example, with the Audio tag, the pattern DTS-HD(?![ .-]?HRA) marked valid, the Regex101 ID LDsZXA/1, and a Unit Tests table where all four DTS releases pass.](https://profilarr.com/images/docs_regex_testing_profilarr[style=light].png)

The DTS example in Profilarr, linked to `LDsZXA/1`, with all four tests passing.

> **Info:** A saved version never changes. Anyone can open `LDsZXA/1` and edit it, but saving their edits creates a separate copy. Profilarr fetches a version's tests and runs them through the parser once, then keeps the results instead of fetching them again. When you change your tests or your pattern, save a new version and link that one instead. Profilarr tests the pattern saved on regex101, not the one saved in Profilarr, so the two need to match.

## Next

- [Test: Custom Formats](https://profilarr.com/test/custom-formats): Testing release titles against a custom format.

---

Index of this site's Markdown pages: https://profilarr.com/llms.txt
