Skip to content

fix(web): content: filter now respects regex mode#947

Merged
brendan-kellam merged 2 commits intomainfrom
brendan/fix-content-expr-regex
Feb 26, 2026
Merged

fix(web): content: filter now respects regex mode#947
brendan-kellam merged 2 commits intomainfrom
brendan/fix-content-expr-regex

Conversation

@brendan-kellam
Copy link
Contributor

@brendan-kellam brendan-kellam commented Feb 26, 2026

Summary

  • content: prefix filters were always using substring matching, ignoring the regex toggle
  • Patterns like content:next-auth.*beta searched for the literal string "next-auth.*beta" instead of treating it as a regex, returning no results
  • ContentExpr now mirrors bare Term behavior: substring when regex is off, regexp when regex is on

Test plan

  • With regex mode OFF: content:hello returns results for files containing the literal string hello
  • With regex mode ON: content:next-auth.*beta returns results matching the regex pattern (e.g. files with "next-auth": "^5.0.0-beta.x")
  • Bare terms still behave the same as before

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the content: filter to properly respect the regex toggle setting. When regex mode is enabled, content filtering now uses regex pattern matching; when disabled, it uses substring matching instead.

Previously, content: prefix filters always used substring matching regardless
of the regex toggle, so patterns like content:next-auth.*beta searched for the
literal string "next-auth.*beta" rather than treating it as a regex.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

This comment has been minimized.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da26b90 and 2eb00ee.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • packages/web/src/features/search/parser.ts

Walkthrough

The PR modifies the content filtering parser to conditionally handle regex-based or substring matching based on an isRegexEnabled flag. When enabled, the parser emits regexp-based IR; otherwise, it preserves the substring structure. A corresponding changelog entry documents this fix.

Changes

Cohort / File(s) Summary
Documentation
CHANGELOG.md
Added entry noting that the content: filter now respects the regex toggle.
Parser Logic
packages/web/src/features/search/parser.ts
Modified ContentExpr handling to conditionally emit regexp-based IR when isRegexEnabled is true, or substring-based IR when false. Applied to both Term/QuotedTerm and ContentExpr branches under PrefixExpr.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch brendan/fix-content-expr-regex

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 and usage tips.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@brendan-kellam brendan-kellam merged commit 8e0e737 into main Feb 26, 2026
6 checks passed
@brendan-kellam brendan-kellam deleted the brendan/fix-content-expr-regex branch February 26, 2026 20:34
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.

1 participant