Skip to main content

SOURCE_REGEX

Static SOURCE_REGEX 

Source
pub static SOURCE_REGEX: Lazy<Regex>
Expand description

Source-class detector. Ported from QualityParser.cs:17-30.

The C# pattern uses three negative lookarounds inside the bluray and webdl branches:

  1. BD(?!$) (bluray branch). Bare BD only counts when not at end of string. Rust workaround: relaxed to BD; match_source rejects a bluray match whose entire captured text is BD and ends at the input boundary.
  2. (?-i:WEB)$ (webdl branch). Case-sensitive uppercase WEB at end of input. Rust regex DOES support (?-i:...) flag-disable groups, so this is ported verbatim.
  3. (?:AMZN|NF|DP)[. -]WEB[. -](?!Rip) (webdl branch). Provider tag followed by WEB and a separator that is not Rip. Rust workaround: drops the (?!Rip) and wraps the provider alternative in a nested named sub-capture (?P<provider_web>...). match_source then gates the post-match (?!Rip) filter on provider_web.is_some(), structurally identifying which alternation branch fired rather than relying on alternation order or prefix heuristics.

Callers reach a fully-correct match through [super::match_source]; the raw SOURCE_REGEX is exported for tests that want to assert which branch the alternation hit (named groups: bluray, webdl, webrip, hdtv, bdrip, brrip, dvd, dsr, pdtv, sdtv, tvrip).