Radarr/Radarr · error · ArgumentException

Unknown or unsupported perl regex modifier: {0}

Error message

Unknown or unsupported perl regex modifier: {0}

What it means

Thrown by PerlRegexFactory when parsing a Perl-style release profile regex and encountering a modifier character not in the supported set (i, m, s, x, n, etc.). The unsupported character is appended to the message. .NET RegexOptions cannot represent every Perl modifier, so Radarr rejects unknown ones.

Source

Thrown at src/NzbDrone.Core/Profiles/Releases/PerlRegexFactory.cs:61

                    case 's':
                        options |= RegexOptions.Singleline;
                        break;

                    case 'i':
                        options |= RegexOptions.IgnoreCase;
                        break;

                    case 'x':
                        options |= RegexOptions.IgnorePatternWhitespace;
                        break;

                    case 'n':
                        options |= RegexOptions.ExplicitCapture;
                        break;

                    default:
                        throw new ArgumentException("Unknown or unsupported perl regex modifier: " + modifier);
                }
            }

            return options;
        }
    }
}

View on GitHub (pinned to ca451608dc)

Solutions

  1. Remove the unsupported modifier from the regex flag suffix — keep only i, m, s, x, n.
  2. For global matching needs ('g'), note Radarr applies the regex per-release, so 'g' is unnecessary.
  3. For Unicode behavior ('u'), .NET regex is Unicode-aware by default; drop the modifier.
  4. Re-save the release profile after correcting the flags.

Example fix

// before: /pattern/ige  -> 'e' (eval) unsupported
// after:  /pattern/i
Defensive patterns

Strategy: validation

Validate before calling

static readonly HashSet<char> SupportedFlags = new() { 'i','m','s','x','n' };
if (modifier != '\0' && !SupportedFlags.Contains(modifier)) {
    throw new ValidationFailure("Regex", $"Unsupported perl modifier '{modifier}'");
}

Type guard

static bool IsValidPerlModifier(char c) => "imsxn".IndexOf(c) >= 0;

Try / catch

try { regex = PerlRegexFactory.Create(pattern); }
catch (ArgumentException ex) when (ex.Message.Contains("perl regex modifier")) {
    _logger.Warn(ex, "Release-profile regex has unsupported modifier; falling back to no flags");
    regex = new Regex(StripFlags(pattern));
}

Prevention

When it happens

Trigger: A release profile's 'Must Contain' / 'Must Not Contain' / 'Preferred' regex uses a Perl-style /pattern/FLAGS suffix with a flag character outside the recognized set (e.g. 'e', 'g', 'p', 'l', 'u', 'a', 'd').

Common situations: Copying regex from a Perl/PCRE tutorial or another indexer tool that supports flags Radarr/.NET does not, importing a shared release profile with PCRE-specific modifiers, or a typo in the flag suffix.

Related errors


AI-assisted analysis of Radarr/Radarr@ca451608dc (2026-08-13). Data as JSON: /api/errors/64fd96fc1cd67a3e. Report an issue: GitHub.