Skip to content

fix: preserve regex terms in global filters - #4194

Open
rootsec1 wants to merge 2 commits into
sqlitebrowser:masterfrom
rootsec1:fix/3971-global-regex-filter
Open

rootsec1 wants to merge 2 commits into
sqlitebrowser:masterfrom
rootsec1:fix/3971-global-regex-filter

Conversation

@rootsec1

Copy link
Copy Markdown

Fixes #3971.

The global “Filter in any column” field split every literal space before passing terms to the existing condition parser. That turned /New York/ into two LIKE filters instead of one REGEXP filter.

This change adds a finite tokenizer at that lexical boundary. It preserves slash-delimited regex terms atomically, keeps ordinary space-separated terms as AND conditions, handles escaped slash parity, and falls back to the previous split behavior for malformed or unmatched slash input. Existing condition parsing, query construction, per-column filters, and project XML remain unchanged.

Tests cover:

  • regex, ordinary, mixed, malformed, escaped-slash, whitespace, and parity cases
  • the issue fixture through the real CondFormat and Query path (/New York/ returns exactly New York)
  • ordinary multi-term AND behavior
  • project filter save/restore behavior

Verification:

  • SQLite Release build and install; all 5 tests pass
  • SQLCipher Release build and install; all 5 tests pass
  • regression tests fail when the tokenizer is replaced with the previous split-on-every-space behavior

Risk is limited to global-filter tokenization. Malformed slash input deliberately retains the previous behavior.

@lucydodo
lucydodo force-pushed the fix/3971-global-regex-filter branch from 7e14419 to ac1334c Compare September 3, 2026 11:31
@lucydodo

Copy link
Copy Markdown
Member

Thank you for your contribution. However, I don't have the expertise to review this PR, so I'll wait for someone else to review it.

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.

[Bug]: Inkonsistent RegExp Filter Behavior in Data Browser

2 participants