Skip to content

Add fancy regex fallback for advanced filters#913

Open
sabbellasri wants to merge 2 commits intodalance:masterfrom
sabbellasri:regex-fancy-fallback
Open

Add fancy regex fallback for advanced filters#913
sabbellasri wants to merge 2 commits intodalance:masterfrom
sabbellasri:regex-fancy-fallback

Conversation

@sabbellasri
Copy link
Copy Markdown
Contributor

@sabbellasri sabbellasri commented May 5, 2026

Summary

Adds a small regex matcher wrapper that keeps Rust's regex crate as the fast path for standard patterns, and falls back to fancy-regex when the fast engine cannot compile an advanced pattern such as lookaround.

This enables filters like positive and negative lookahead while preserving the existing fast behavior for common regex usage.

Related to #554
Closes #905

cc @beelze

Changes

  • Added fancy-regex as a dependency
  • Added a shared SearchRegex wrapper for fast/fancy engine selection
  • Updated normal filtering to use the shared matcher
  • Updated watch-mode regex validation to use the same matcher
  • Added tests for standard regex, positive lookahead, and negative lookahead

Testing

  • cargo fmt
  • cargo check
  • cargo test

Result: 12 passed; 0 failed

@sabbellasri
Copy link
Copy Markdown
Contributor Author

Hi @dalance,

I opened PR #913 to address the lookaround support request from #905.

The PR adds a small matcher wrapper that keeps Rust’s regex crate as the fast path for normal patterns and falls back to fancy-regex only when the standard engine cannot compile advanced patterns like lookaheads/lookarounds.

All checks are passing, and the PR can be cleanly merged. Please let me know if you would prefer a different approach or any changes before 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.

Add support for lookarounds in regex filtering (fancy-regex integration)

1 participant