{"record":{"id":"b5cf09816e007517","repo":"projectdiscovery/subfinder","slug":"invalid-value-for-match-regex-option","errorCode":null,"errorMessage":"invalid value for match regex option","messagePattern":"invalid value for match regex option","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runner/validate.go","lineNumber":58,"sourceCode":"\t\treturn errors.New(\"hostip flag must be used with RemoveWildcard option\")\n\t}\n\n\t// The per-source results limit cannot be negative.\n\tif options.MaxResults < 0 {\n\t\treturn fmt.Errorf(\"max-results cannot be negative\")\n\t}\n\n\t// The response body size limit cannot be negative.\n\tif options.MaxResponseBodySize < 0 {\n\t\treturn fmt.Errorf(\"response-size-read cannot be negative\")\n\t}\n\n\tif options.Match != nil {\n\t\toptions.matchRegexes = make([]*regexp.Regexp, len(options.Match))\n\t\tvar err error\n\t\tfor i, re := range options.Match {\n\t\t\tif options.matchRegexes[i], err = regexp.Compile(stripRegexString(re)); err != nil {\n\t\t\t\treturn errors.New(\"invalid value for match regex option\")\n\t\t\t}\n\t\t}\n\t}\n\tif options.Filter != nil {\n\t\toptions.filterRegexes = make([]*regexp.Regexp, len(options.Filter))\n\t\tvar err error\n\t\tfor i, re := range options.Filter {\n\t\t\tif options.filterRegexes[i], err = regexp.Compile(stripRegexString(re)); err != nil {\n\t\t\t\treturn errors.New(\"invalid value for filter regex option\")\n\t\t\t}\n\t\t}\n\t}\n\n\tsources := mapsutil.GetKeys(passive.NameSourceMap)\n\tfor source := range options.RateLimits.AsMap() {\n\t\tif !sliceutil.Contains(sources, source) {\n\t\t\treturn fmt.Errorf(\"invalid source %s specified in -rls flag\", source)\n\t\t}","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/projectdiscovery/subfinder/blob/7a0b91f0fac01b62c65328bd771a3560ae611d6a/pkg/runner/validate.go#L40-L76","documentation":"Compile-time validation failure in Options.validateOptions: one of the -m/--match regex patterns failed to compile after stripRegexString processing (the wrapped regexp.Compile error is discarded and replaced by this sentinel). The offending value is the pattern at the failing index of options.Match.","triggerScenarios":"Thrown at pkg/runner/validate.go:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Test the pattern with a small Go program or an online RE2 tester before passing it via -m","Ensure the pattern is valid Go regexp (RE2) syntax — no backreferences or lookaheads","Wrap the pattern appropriately; note subfinder strips surrounding quotes/regex delimiters via stripRegexString before compiling","Print the underlying regexp.Compile error alongside this message to pinpoint the bad expression"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a0b91f0fac01b62c65328bd771a3560ae611d6a","analyzedAt":"2026-09-06T23:52:02.109Z","contentChangedAt":"2026-09-06T23:52:02.109Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}