RE2 Regex Filter Cookbook for Search Console
A collection of battle-tested regular expression patterns built specifically for Google Search Console’s RE2 syntax engine.
RE2 Engine Technical Specifications
Google Search Console evaluates regex filters using Google’s open-source RE2 regular expression engine. RE2 is engineered to run in guaranteed linear time O(n) to eliminate catastrophic backtracking.
Character classes, word boundaries (\b), repetitions ({n,m}), alternations (|), and case-insensitive flags ((?i)).
Lookarounds ((?=...), (?!...)), backreferences (\1), and possessive quantifiers will cause filter errors.
Tested RE2 Filter Patterns
Brand Variations & Common Typos
(?i)(naben|nabin|shrestha|nabenshrestha) Matches any search query containing common spelling variants of the brand name, regardless of capitalization. Use "Queries not matching regex" to isolate pure non-brand organic discovery.
Informational Question Queries
(?i)^(who|what|where|when|why|how|can|is|are|does|do|should|would)\b Matches queries that start with classic interrogative words, capturing high-intent educational questions ideal for featured snippets and documentation.
Commercial & High-Intent Comparison
(?i)\b(vs|versus|compare|alternative|best|review|pricing|cost|worth it)\b Captures queries where searchers are evaluating options, comparing solutions, or checking costs prior to conversion.
Long-Tail Queries (4+ Words)
^([^ ]+ ){3,}[^ ]+$ Identifies highly specific long-tail queries consisting of 4 or more space-separated words. These queries typically have lower volume but higher conversion intent.
Short Head-Terms (1 to 2 Words)
^[^ ]+( [^ ]+)?$ Filters search queries that contain only 1 or 2 words. Useful for monitoring high-competition head terms and broad industry keywords.
Specific Directory Isolation
^https?://[^/]+/handbook/module-[0-9]+/.* Isolates all URLs that reside within specific module directories while excluding homepage, overview pages, or unrelated directories.
Numeric IDs / Paginated URLs
.*(/page/[0-9]+|\?p=[0-9]+|-[0-9]{5,}\.html).* Captures paginated URL variations or items indexed with dynamic numeric identifiers.
Problem-Solving & Debugging Queries
(?i)\b(error|fix|solved|bug|failed|not working|crash|issue|missing)\b Filters technical troubleshooting queries where users are actively trying to solve an operational error.
Common RE2 Gotchas in Search Console
- Case Sensitivity by Default: Search queries in GSC are stored in lowercase, but URLs are case-sensitive. Always prepend
(?i)when matching queries to ensure variations don't get accidentally excluded. - No Need to Escape Forward Slashes: In JavaScript regex literals you must escape slashes (
\/). In GSC filter inputs, you write clean slashes (/handbook/module-1/). - Partial Matching: By default, RE2 in GSC looks for the pattern anywhere in the string unless anchored with
^(start of string) or$(end of string).