This site is still a work in progress. For the current docs, head to dictionarry.dev.

Regular Expressions

Profilarr doesn’t have its own test editor for regular expressions. Instead, tests live on 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, 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):

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 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 to see it for yourself.

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 in Profilarr. Profilarr keeps just the ID and version, LDsZXA/1, and shows the results under Unit Tests.

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.