Skip to content

fix(runner): preserve case sensitivity for match-regex and filter-regex flags (#2523)#2524

Open
ThryLox wants to merge 1 commit into
projectdiscovery:devfrom
ThryLox:fix/match-regex-case-sensitivity
Open

fix(runner): preserve case sensitivity for match-regex and filter-regex flags (#2523)#2524
ThryLox wants to merge 1 commit into
projectdiscovery:devfrom
ThryLox:fix/match-regex-case-sensitivity

Conversation

@ThryLox

@ThryLox ThryLox commented Jun 27, 2026

Copy link
Copy Markdown

Summary

Fixes #2523 by preserving case sensitivity for -mr (match-regex) and -fe (filter-regex) command-line flags.

Root Cause

Previously, -mr and -fe flags were registered with goflags.NormalizedStringSliceOptions in runner/options.go, which automatically converted user-supplied regex strings to lowercase (e.g. converting [0-9A-Z] to [0-9a-z]). This caused valid case-sensitive regex patterns to fail matching against response bodies.

Fix

Replaced goflags.NormalizedStringSliceOptions with goflags.StringSliceOptions for OutputMatchRegex and OutputFilterRegex, matching the existing behavior of -er (extract-regex).

…ex flags (projectdiscovery#2523)

Previously, -mr (match-regex) and -fe (filter-regex) flags were registered with goflags.NormalizedStringSliceOptions, which automatically converted regex inputs to lowercase. This caused case-sensitive regex patterns and character sets (e.g. [0-9A-Z]) to fail matching against response bodies. Replaced with goflags.StringSliceOptions to preserve exact string case during flag parsing, matching the behavior of -er (extract-regex).
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The --match-regex (-mr) and --filter-regex (-fe) CLI flags in ParseOptions are changed from goflags.NormalizedStringSliceOptions to goflags.StringSliceOptions, preventing normalization of the provided regex strings before compilation.

Changes

Regex flag normalization fix

Layer / File(s) Summary
Switch -mr and -fe to StringSliceOptions
runner/options.go
Both --match-regex and --filter-regex flag registrations changed from NormalizedStringSliceOptions to StringSliceOptions, preserving the original regex string (including case and special characters) instead of applying normalization.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐇 A rabbit once typed [0-9A-Z]{6},
But normalized flags made the pattern quite mixed.
Two lines swapped their type, just StringSlice will do,
No more silent normalization eating my brew.
Now -mr and -fe match exactly as written — hooray!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: preserving regex case sensitivity for the runner's match and filter flags.
Linked Issues check ✅ Passed The flag parser swap preserves regex casing for -mr and aligns its behavior with -er as requested by #2523.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to the documented regex flag parsing fix and adds no unrelated behavior.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent behavior between -mr and -er in v1.9.0 for same regex pattern

1 participant