A practical guide to finding the queries that can improve your article’s rankings in Google and AI-driven search.
Table of Contents
ToggleIntroduction
Most people use Google Search Console (GSC) by typing a word into the Query filter. That works, but it only finds queries containing that exact word. Regular expressions (regex) let you filter by patterns instead: every question, every query longer than seven words, every comparison, every troubleshooting search.
This guide explains 12 expressions you can paste straight into Search Console, what every character does, and how to turn the results into article improvements.
How regex filtering works in Search Console
Where to use it: Performance → Search results → + New → Query → choose Custom (regex) → choose Matches regex or Doesn’t match regex → paste the expression → Apply.
A few rules to know before you start:
- Partial matching is the default. The pattern matches if it appears anywhere in the query. Use ^ (start) and $ (end) when you need to control position.
- GSC uses RE2 syntax. It supports groups, alternation (|), \b, \s, \S, \d and counted repeats like {7,}. It does not support lookaheads, lookbehinds or backreferences.
- Queries are normally displayed in lowercase, so you rarely need to worry about capital letters in Query filters. For Page (URL) filters, start the pattern with (?i) to ignore case.
- Length limit: the expression can be at most 4,096 characters.
- Exclusion: switching to Doesn’t match regex inverts any pattern below.
How these expressions were checked
Every expression in this guide was run against sample queries that should match and queries that should not. Two patterns from an earlier draft failed that test and have been fixed here:
- The comparison pattern included the bare word or, which matched far too many ordinary queries.
- The local-intent pattern included in [a-z]+, which matched queries like “how to cook in oven”.
The versions below are the corrected ones. Search Console’s own regex tester does not exist, so also test on your own data and check the results with a quick sort before acting on them.
Expression 1: Long queries (8 or more words)
^(?:\S+\s+){7,}\S+$
What it finds: queries that are at least eight words long, such as “how do i fix a leaking tap under the kitchen sink”.
Character by character
| Part | Meaning |
| ^ | Start of the query |
| (?: … ) | Group the contents without capturing them |
| \S+ | One or more non-space characters (a word) |
| \s+ | One or more spaces |
| {7,} | Repeat the group 7 or more times |
| \S+ | The final word, with no trailing space |
| $ | End of the query |
Why it matters: long queries are specific and conversational. They reveal exact problems your readers have and are close to how people phrase prompts in AI assistants.
How to use it: list the queries, group them by topic, and add a section or FAQ entry for each real question your article does not yet answer.
Adjusting the length: the number inside { } is the word count minus one. {4,} means 5+ words, {9,} means 10+ words.
Expression 2: Queries of a specific length (5 to 7 words)
^(?:\S+\s+){4,6}\S+$
What it finds: queries with 5, 6 or 7 words. This is the same structure as Expression 1, but {4,6} sets both a minimum and a maximum.
Short-query variants
| Goal | Expression |
| Exactly 1 word | ^\S+$ |
| Exactly 2 words | ^\S+\s+\S+$ |
| Exactly 3 words | ^\S+\s+\S+\s+\S+$ |
Why it matters: short queries are broad and competitive; mid-length queries (4 to 7 words) are often the best balance of volume and intent. Comparing performance across length bands shows where your article is strongest.
Expression 3: Question queries
^(who|what|when|where|why|how|which|can|does|do|is|are|should|will|could|would)\s
What it finds: queries that begin with a question word followed by a space.
How it works: ^ pins the match to the start, the group lists the allowed opening words separated by | (“or”), and \s requires a space afterward. That final \s is important: without it, “whatsapp web” would match “what”.
Why it matters: each question is a ready-made H2 or H3 heading. Search engines and AI systems both favour pages that state a question and answer it directly.
How to use it: write a clear heading using the question, then a direct 40 to 60 word answer beneath it, followed by deeper detail.
Limitation: it only catches questions that start with these words. A query like “seo audit how often” is not matched.
Expression 4: Conversational, AI-style queries
^(can you|could you|please|tell me|explain|give me|suggest|recommend|help me|i need|i want)\s
What it finds: queries phrased as requests, the way people talk to an assistant.
Why it matters: this style is typical of prompts typed into AI tools and of longer natural-language searches. Seeing which requests lead people to your page shows what tasks they want completed, not just which keywords they type.
How to use it: answer the request directly near the top of the article (a summary, steps, a short list) rather than burying it.
Note: the trailing \s prevents “explanation of seo” from matching “explain”. Expect lower volumes than Expression 3.
Expression 5: Comparison queries
\b(vs|versus|compared (to|with)|difference between|alternatives?|better than|instead of)\b
What it finds: queries comparing two options, such as “yoast vs rank math” or “semrush alternatives”.
Character by character
| Part | Meaning |
| \b | Word boundary, so “vs” does not match inside another word |
| compared (to|with) | “compared to” or “compared with” |
| alternatives? | “alternative” or “alternatives” (? makes the final “s” optional) |
Why it matters: comparison searchers are weighing a decision. A side-by-side table with a clear verdict is the format most likely to satisfy them, and tables are easy for AI systems to extract.
Fixed from the earlier draft: the old pattern contained a bare or, which would match any query with the word “or” in it.
Expression 6: Commercial-intent queries
\b(best|top|reviews?|price|pricing|cost|cheap|affordable|buy|discount|worth it)\b
What it finds: queries from people researching or close to buying.
Why it matters: these queries often convert best. Pages that win them usually include clear pricing, pros and cons, honest recommendations and evidence of first-hand experience.
Note: \b stops “costume ideas” from matching “cost”.
Expression 7: How-to and informational queries
\b(how to|guide|tutorial|tips|steps|ideas|examples?|template|checklist|for beginners)\b
What it finds: learning-intent queries.
How to use it: check whether your article format matches the wording. People searching “checklist” want a scannable list, “template” wants something downloadable or copyable, and “for beginners” wants plain language with no assumed knowledge.
Expression 8: Troubleshooting queries
\b(not working|errors?|fix(es|ing)?|problems?|issues?|can’t|cannot|fails?|failed)\b
What it finds: people with a problem to solve.
How it works: fix(es|ing)? matches “fix”, “fixes” and “fixing”, but not “prefix”, because of the leading \b. The apostrophe in can’t is a plain character, so it needs no escaping.
Why it matters: these searchers want the solution immediately. Put the likely cause and the fix near the top, then explain why it works.
Expression 9: Queries that contain a year
\b20[2-3][0-9]\b
What it finds: queries containing a year from 2020 to 2039.
How it works: 20 is literal, [2-3] is one digit from 2 to 3, [0-9] is any digit, and \b on both sides keeps it from matching inside longer numbers such as “12000”.
Why it matters: a year signals that people want current information. If your article ranks for “best tools 2026”, the title, intro and facts should be genuinely updated and say so.
Expression 10: List-style queries
\b\d+\s(ways|tips|ideas|examples|tools|steps|mistakes|reasons|best)\b
What it finds: queries such as “10 ways to rank” or “top 5 tools”.
How it works: \d+ is one or more digits, \s is a space, and the group lists the nouns that typically follow a number.
Why it matters: these queries signal that readers expect a numbered list. A plain \d would match every query with a digit in it (phone models, addresses), so this tighter version is more useful.
Expression 11: Local-intent queries
\b(near me|nearby|open now|closest|around me)\b
What it finds: searches tied to the searcher’s location.
Fixed from the earlier draft: the earlier in [a-z]+ matched any query containing “in” followed by a word, so it was removed.
To find a specific place, just use a normal contains filter for the city name, for example srinagar|jammu.
Expression 12: Non-branded queries (exclude your brand)
Set the dropdown to Doesn’t match regex and use:
yourbrand|your brand|yourbrnad
What it does: removes queries containing your brand name so you see only people who did not already know you. Replace the placeholders with your real brand and its common misspellings.
Alternative: Search Console also has a built-in Non-branded queries option in the same dialog. It is faster, but a custom regex gives you control over unusual spellings.
Combining expressions
Use | to mean “or”:
^(how|why|what)\s|\bvs\b
This reads as: starts with how, why or what, or contains the word “vs”. The ^ applies only to the first side of the |.
You can also stack separate filters: a Query regex plus a Page filter for a single URL shows exactly what that one article ranks for. Add the Page filter in the same + New menu.
A repeatable workflow
- Open the Page filter for your article’s URL.
- Apply one expression at a time (start with Expressions 3, 1 and 5).
- Sort by Impressions and show the Position column.
- Find striking-distance queries at positions 8 to 20. Small improvements here can lift you onto page one.
- Find high impressions with low CTR. Rewrite the title and meta description to match the intent more closely.
- Update the article: add headings for real questions, direct answers, tables for comparisons, and a refreshed year where relevant.
- Wait four to six weeks, then repeat with the same filters and compare.
What this means for AI platforms
Search Console reports Google Search data. As far as I know, Google includes AI-feature impressions and clicks in the standard totals and does not report them separately, so check Google’s current documentation for changes. It also says nothing about ChatGPT, Perplexity or other assistants.
What you can do is use long, conversational and question-style queries (Expressions 1, 3 and 4) as a proxy for how people phrase prompts. Content that tends to perform well in both classic and AI results has:
- A clear question or topic as a heading, with a direct answer immediately below it
- Accurate, specific facts and named sources
- Logical structure: short sections, lists and tables
- Genuine experience or expertise, with an identifiable author
- Fresh updates when the topic changes
No regex guarantees rankings or AI citations. These filters show you what people want; the quality of your article decides whether you deserve to be shown.
One correction to common advice
People often recommend adding FAQ structured data to every article. Google restricted FAQ rich results in 2023 to well-known government and health sites, so most sites will not see them. A visible FAQ section is still useful for readers and for answer extraction, but do not expect a rich result from the markup.
Quick reference
| # | Purpose | Expression |
| 1 | 8+ word queries | ^(?:\S+\s+){7,}\S+$ |
| 2 | 5 to 7 word queries | ^(?:\S+\s+){4,6}\S+$ |
| 3 | Questions | ^(who|what|when|where|why|how|which|can|does|do|is|are|should|will|could|would)\s |
| 4 | Conversational | ^(can you|could you|please|tell me|explain|give me|suggest|recommend|help me|i need|i want)\s |
| 5 | Comparisons | \b(vs|versus|compared (to|with)|difference between|alternatives?|better than|instead of)\b |
| 6 | Commercial | \b(best|top|reviews?|price|pricing|cost|cheap|affordable|buy|discount|worth it)\b |
| 7 | How-to | \b(how to|guide|tutorial|tips|steps|ideas|examples?|template|checklist|for beginners)\b |
| 8 | Troubleshooting | \b(not working|errors?|fix(es|ing)?|problems?|issues?|can’t|cannot|fails?|failed)\b |
| 9 | Year | \b20[2-3][0-9]\b |
| 10 | List-style | \b\d+\s(ways|tips|ideas|examples|tools|steps|mistakes|reasons|best)\b |
| 11 | Local | \b(near me|nearby|open now|closest|around me)\b |
| 12 | Exclude brand | yourbrand|your brand|yourbrnad (Doesn’t match) |
In the table, the \| is only there to keep the table formatting intact. In Search Console, type a plain |.
Where to learn more
- Regex101 (regex101.com): paste any expression and see a live breakdown. Choose the Golang flavor, which is closest to RE2.
- RE2 syntax reference (github.com/google/re2/wiki/Syntax): the official list of what is and is not supported.
- RegexOne (regexone.com): interactive beginner lessons.
- Google Search Console Help: the regex section explains the Query and Page filters.