{"record":{"id":"64fd96fc1cd67a3e","repo":"Radarr/Radarr","slug":"unknown-or-unsupported-perl-regex-modifier-0","errorCode":null,"errorMessage":"Unknown or unsupported perl regex modifier: {0}","messagePattern":"Unknown or unsupported perl regex modifier: (.+?)","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/NzbDrone.Core/Profiles/Releases/PerlRegexFactory.cs","lineNumber":61,"sourceCode":"\n                    case 's':\n                        options |= RegexOptions.Singleline;\n                        break;\n\n                    case 'i':\n                        options |= RegexOptions.IgnoreCase;\n                        break;\n\n                    case 'x':\n                        options |= RegexOptions.IgnorePatternWhitespace;\n                        break;\n\n                    case 'n':\n                        options |= RegexOptions.ExplicitCapture;\n                        break;\n\n                    default:\n                        throw new ArgumentException(\"Unknown or unsupported perl regex modifier: \" + modifier);\n                }\n            }\n\n            return options;\n        }\n    }\n}\n","sourceCodeStart":43,"sourceCodeEnd":69,"githubUrl":"https://github.com/Radarr/Radarr/blob/ca451608dc60c6cec754aba8d96bfa30e9468ed5/src/NzbDrone.Core/Profiles/Releases/PerlRegexFactory.cs#L43-L69","documentation":"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.","triggerScenarios":"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').","commonSituations":"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.","solutions":["Remove the unsupported modifier from the regex flag suffix — keep only i, m, s, x, n.","For global matching needs ('g'), note Radarr applies the regex per-release, so 'g' is unnecessary.","For Unicode behavior ('u'), .NET regex is Unicode-aware by default; drop the modifier.","Re-save the release profile after correcting the flags."],"exampleFix":"// before: /pattern/ige  -> 'e' (eval) unsupported\n// after:  /pattern/i","handlingStrategy":"validation","validationCode":"static readonly HashSet<char> SupportedFlags = new() { 'i','m','s','x','n' };\nif (modifier != '\\0' && !SupportedFlags.Contains(modifier)) {\n    throw new ValidationFailure(\"Regex\", $\"Unsupported perl modifier '{modifier}'\");\n}","typeGuard":"static bool IsValidPerlModifier(char c) => \"imsxn\".IndexOf(c) >= 0;","tryCatchPattern":"try { regex = PerlRegexFactory.Create(pattern); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"perl regex modifier\")) {\n    _logger.Warn(ex, \"Release-profile regex has unsupported modifier; falling back to no flags\");\n    regex = new Regex(StripFlags(pattern));\n}","preventionTips":["Restrict perl modifiers to i, m, s, x, n (the .NET-mappable set).","Avoid copy-pasting regex with PCRE-specific flags (e, g, u, a).","Strip unknown flags before saving shared release profiles.","Test regex in the release-profile editor before saving."],"tags":["regex","release-profiles","perl","validation","configuration"],"backgroundTag":null,"analyzedSha":"ca451608dc60c6cec754aba8d96bfa30e9468ed5","analyzedAt":"2026-08-13T17:21:54.115Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}