Regex Filtering Techniques for Torrent RSS Feeds
Torrent RSS downloaders rely on regular expressions (regex) to automate the filtering and downloading of media files based on release titles. Using precise regex patterns prevents accidental downloads of incorrect resolutions, unwanted release groups, low-quality recordings, or duplicate episodes. This guide outlines the essential regex filtering techniques used in torrent clients like qBittorrent, ruTorrent, and automated tools like Flexget to achieve exact matching.
1. Handling Separators with Character Classes
Release titles frequently use dots, spaces, underscores, or hyphens
interchangeably (e.g., Show.Name, Show_Name,
or Show Name). Hardcoding spaces or dots often leads to
missed matches.
To match any standard separator, use a character class:
Show[._\s-]Name
Alternatively, using the shorthand [.\s_-]+ allows for
multiple consecutive delimiters.
2. Precise Season and Episode Matching
A common pitfall in RSS matching is capturing season packs when looking for single episodes, or capturing double-digit seasons incorrectly.
Standard SxxExx Matching:
^Show[.\s]Name[.\s]S01E\d{2}\b\d{2}ensures exactly two digits for the episode number, while\b(word boundary) prevents matching longer numerical strings.Specific Episode Ranges:
^Show[.\s]Name[.\s]S01E(0[1-5])\bThis pattern strictly matches episodes
01through05of season 1.Daily or Date-based Formats:
Show[.\s]Name[.\s]\d{4}[.\s]\d{2}[.\s]\d{2}Matches formats like
Show.Name.2023.10.25.
3. Quality and Codec Filtering via Alternation
Torrents are released in various formats and codecs. Using
alternation (|) inside non-capturing groups
(?:) allows filtering for acceptable quality parameters
without cluttering the match.
Resolution Matching:
\b(1080p|2160p|4K)\bSource and Codec Matching:
\b(WEB[-._]?DL|BluRay|WEBRip)\b.*\b(x264|x265|HEVC|AV1)\bCombining these ensures that only releases meeting specific resolution and encoding criteria are accepted.
4. Negative Lookahead for Exclusion
Most RSS downloaders feature separate “Must Not Contain” fields, but
inline regex using negative lookaheads (?!...) allows
advanced conditional logic inside a single rule.
Excluding Low-Quality or Unwanted Sources:
^(?!.*(?:CAM|TS|TeleSync|HDCAM|Sample)).*This skips any title containing poor-quality tags regardless of where they appear in the filename.
Excluding Repacks or Specific Groups:
^(?!.*(?:PROPER|REPACK)).*Show[.\s]Name.*
5. Multi-Condition Matching with Positive Lookahead
When a release title can have tags listed in unpredictable orders,
sequential regex might fail. Positive lookaheads (?=...)
allow matching multiple required tags anywhere in the title.
Example: Matching a title containing the show name, 1080p, and a specific release group, regardless of tag order:
^(?=.*Show[.\s]Name)(?=.*1080p)(?=.*(NTb|FLUX)).*$
6. Case Insensitivity Flags
Most BitTorrent client RSS engines apply case-insensitive matching by
default. If manual control is supported by the regex engine (PCRE),
prepend (?i) to ignore case variations:
(?i)^Show\.Name\.S01E\d{2}
Complete Filter Examples
TV Show Filter (1080p WEB-DL, specific groups, excluding CAM):
^(?!.*(?:CAM|TS|Sample))Show[.\s]Name[.\s]S\d{2}E\d{2}[.\s].*(1080p).*(WEB-DL|WEBRip).*(NTb|FLUX|CasStudio)Movie Filter (2160p HDR/DV release):
^(?!.*(?:CAM|HDTS))Movie[.\s]Title[.\s]\(?\d{4}\)?[.\s].*(2160p|4K).*(HDR|DV|DOVI).*(BluRay|WEB-DL)