Summary
In search / faster_search with mode=regex (flavor zigrep_basic), the | alternation operator does not work and the search returns 0 matches silently — no error, no warning. This reads as a confident "pattern not found" when the terms are actually present, which is actively misleading and caused me to draw wrong conclusions while searching a codebase.
Reproduction
File index.ts line 1:
import { generateText, streamText, createGateway } from "ai";
| pattern |
mode |
result |
expected |
createGateway |
regex |
2 matches ✓ |
2 |
generateText|streamText |
regex |
0 matches ✗ |
matches line 1 |
nonexistentword|createGateway |
regex |
0 matches ✗ |
matches createGateway |
The single-term regex finds it; the moment an alternation | is added, the whole query returns 0 — even though one of the alternatives clearly matches.
Impact
- Silent false negatives. A multi-term
a|b|c "does any of these exist" sweep — a very common first-pass search — returns 0 and looks authoritative.
- No signal that alternation is unsupported. If
zigrep_basic is intentionally POSIX BRE (where | is a literal char, alternation requires \|), that's a reasonable engine choice, but it's a footgun without feedback.
Suggested fix (any one)
- Support ERE-style
| alternation in mode=regex, or
- If
| is literal in BRE, detect a bare | in a regex pattern and surface a hint (e.g. "| is literal in basic regex; use \\| for alternation or split into multiple queries"), or
- At minimum, document the flavor's alternation semantics in the tool description.
Environment
- codedbpro v0.2.9
- Both
search and faster_search regex modes affected (same backend).
Summary
In
search/faster_searchwithmode=regex(flavorzigrep_basic), the|alternation operator does not work and the search returns 0 matches silently — no error, no warning. This reads as a confident "pattern not found" when the terms are actually present, which is actively misleading and caused me to draw wrong conclusions while searching a codebase.Reproduction
File
index.tsline 1:createGatewaygenerateText|streamTextnonexistentword|createGatewaycreateGatewayThe single-term regex finds it; the moment an alternation
|is added, the whole query returns 0 — even though one of the alternatives clearly matches.Impact
a|b|c"does any of these exist" sweep — a very common first-pass search — returns 0 and looks authoritative.zigrep_basicis intentionally POSIX BRE (where|is a literal char, alternation requires\|), that's a reasonable engine choice, but it's a footgun without feedback.Suggested fix (any one)
|alternation inmode=regex, or|is literal in BRE, detect a bare|in a regex pattern and surface a hint (e.g."| is literal in basic regex; use \\| for alternation or split into multiple queries"), orEnvironment
searchandfaster_searchregex modes affected (same backend).