Distinguish qBittorrent and Cleanuparr pattern syntax in Lists

CodeX
2026-04-10 16:26:27 +02:00
parent 90c86e4684
commit d74d6cfdf2
+61 -18
@@ -90,27 +90,70 @@ has the entry, the entry stays gone (which is probably what you want).
## Pattern syntax ## Pattern syntax
Each line in `blacklist` and `whitelist` is a pattern. The forms supported The patterns in `blacklist` and `whitelist` are consumed by two tools with
are the same forms that qBittorrent's excluded file names accepts, since different pattern capabilities. This section documents both and explains
that is where blacklist patterns ultimately end up via Cleanuparr's which to use.
Blocklist Sync:
| Form | Example | Matches | ### qBittorrent (via Blocklist Sync)
|---|---|---|
| `*example` | `*.srt` | File name ends with `example` |
| `example*` | `sample*` | File name starts with `example` |
| `*example*` | `*sample*` | File name contains `example` |
| `example` | `RARBG.txt` | File name is exactly `example` |
| `regex:<regex>` | `regex:.*\.srt$` | File name matches the regex |
Cleanuparr's Malware Blocker accepts the same forms when reading the qBittorrent's "Excluded file names" field uses Qt glob wildcards
whitelist for Sonarr/Radarr queue inspection, so a single set of pattern (internally `QRegularExpression::fromWildcard()`). The following forms are
forms covers both consumers. supported:
The forms are not interchangeable from the merge script's point of view. | Pattern | Meaning | Example | Matches |
`*.srt` and `regex:.*\.srt$` describe the same set of files but are |---|---|---|---|
different strings. The whitelist subtraction (next section) is exact-string, | `*` | Zero or more characters | `*.srt` | Any file ending in `.srt` |
so picking one form and using it consistently in both files matters. | `?` | Exactly one character | `*.r??` | `.r00`, `.r01`, ..., `.r99` |
| `[abc]` | One character from the set | `*.[rs]00` | `.r00` or `.s00` |
| `[a-z]` | One character in the range | `*.[r-z]??` | `.r00` through `.z99` |
| `[!abc]` | One character NOT in the set | `*.[!m]??` | Any 3-char ext not starting with `m` |
| Literal | Exact string match | `VOSTFR` | A file named exactly `VOSTFR` |
**Not supported by qBittorrent:** regex syntax (`^`, `$`, `\d`, `\w`,
`(?i)`, `+`, etc.), backslash escapes (backslash is not an escape
character in Qt glob), and the `regex:` prefix. Any of these will be
silently ignored or matched literally, causing the pattern to fail.
To match special glob characters literally, place them in brackets:
`[?]` matches a literal question mark, `[*]` matches a literal asterisk.
Reference: [Qt 6 QRegularExpression::fromWildcard](https://doc.qt.io/qt-6/qregularexpression.html#fromWildcard)
### Cleanuparr Malware Blocker (Sonarr/Radarr queue)
Cleanuparr's Malware Blocker supports all the wildcard forms above plus
regex with the `regex:` prefix:
```
regex:.*\.srt$
```
Regex patterns only work in Cleanuparr's Malware Blocker when it reads the
whitelist (or blacklist) directly for queue inspection. They do **not**
work when pushed to qBittorrent via Blocklist Sync, because qBittorrent
does not understand the `regex:` prefix.
### Which forms to use
Since the blacklist is pushed to qBittorrent via Blocklist Sync, all
entries in `blacklist` and `whitelist` should use **wildcard forms only**
(the first six rows in the table above). This ensures patterns work in
both consumers:
- qBittorrent (via Blocklist Sync) -- wildcards only
- Cleanuparr Malware Blocker (direct) -- wildcards and regex both work
Using wildcards everywhere is the safe default. Avoid `regex:` unless you
are certain the pattern will only be consumed by Cleanuparr's Malware
Blocker and never pushed to qBittorrent.
### Merge script interaction
The merge script subtracts the whitelist from the blacklist as exact
strings, not by pattern semantics. The forms are not interchangeable:
`*.srt` and `*.[s]rt` describe the same files but are different strings,
so putting one in the whitelist will not strip the other from the
blacklist. Pick one form and use it consistently in both files.
## Pattern matching ## Pattern matching