Skip to content

Conversation

@librajt
Copy link

@librajt librajt commented Jan 7, 2026

add regex filter support


Summary by cubic

Add regex support to text filters for messages and connections using the /pattern/flags format, with a safe fallback to case-insensitive substring matching. This makes filtering more flexible while preserving existing behavior.

  • New Features
    • Supports /pattern/flags regex in filterMessages and filterConnections (matches against message data, connection URL, and ID).
    • Defaults to case-insensitive ("i") when no flags are provided; invalid regex falls back to substring matching.
    • Invert filtering continues to work with regex matches.

Written for commit ae47261. Summary will update on new commits.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/utils/filterUtils.js">

<violation number="1" location="src/utils/filterUtils.js:82">
P1: Stateful regex bug: If user provides a regex with the global flag (e.g., `/pattern/g`), the `lastIndex` state persists across `.test()` calls, causing incorrect filtering. Consider stripping the `g` flag in `parseRegexFromFilter` since it's not needed for filter matching, or reset `regex.lastIndex = 0` before each test.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

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