Regular Expression Generator
Generate a regular expression for a set of words and phrases of interest to obtain the desired traffic slice in analytics services.
Where does this apply?
The resulting regular expressions are used to segment users and their visits (or sessions) in the Yandex Metrica and Google Analytics web analytics services.
The resulting regular expressions can also be used to group search traffic in Google Search Console and in reports built from its data in Google Looker Studio (formerly Data Studio).
Analyze non-branded traffic
Regular expressions can be used to obtain data on non-branded traffic (rather than general traffic, which combines both non-branded and branded queries). Branded queries will likely drive traffic to your site even without any SEO, so when assessing the effectiveness of SEO traffic, it's important to focus on the dynamics of non-branded traffic.
Frequently Asked Questions
To create a regular expression that identifies traffic from brand search queries, enter all possible spellings of your company and website brand into the text field, including typos (each variant on a new line). For example, "iphone", "i phone", "apple", and "aple". It is also recommended to include corporate phone numbers and email addresses in the list of branded phrases, as some users may visit your site through such queries.
Try applying the generated regular expression and review examples of search queries that fall into the selection. It is possible that some variations of branded queries with typos may not be accounted for, in which case you need to expand the list of phrases and regenerate the expression.
Use our ready-made regex recipes to detect search queries with questions, which can be used to create a useful FAQ block on website pages.
Questions in English for Google Search Console: (?i)\b(am|are|be|been|can|could|did|do|does|had|has|have|how|is|may|might|must|shall|should|was|were|what|when|where|which|who|whom|whose|why|will|would)\b
Questions in English for Yandex Metrica: ~.*am.*|.*are.*|.*be.*|.*been.*|.*can.*|.*could.*|.*did.*|.*do.*|.*does.*|.*had.*|.*has.*|.*have.*|.*how.*|.*is.*|.*may.*|.*might.*|.*must.*|.*shall.*|.*should.*|.*was.*|.*were.*|.*what.*|.*when.*|.*where.*|.*which.*|.*who.*|.*whom.*|.*whose.*|.*why.*|.*will.*|.*would.*
Below are regular expressions for transactional queries focused on service websites and online stores. For example, for an online cinema, transactional queries would include the word "watch," and for an online library, the word "read."
Transactional queries in English for Google Search Console: buy|cheap|price|purchase|order
Transactional queries in English for Yandex Metrica: ~.*buy.*|.*cheap.*|.*price.*|.*purchase.*|.*order.*
Yes, this way you can get a regular expression for segmenting pages as entry points to the site. Note that all nested URLs under the specified ones (e.g., subsections) will also be included in such a segment. To avoid this, append the $ symbol (indicating the end of the line) to the end of each page URL.
Use the following segment in Google Analytics 4 for AI system domains to create a new channel group: ^(?:chatgpt\.com|chat-gpt\.org|claude\.ai|quillbot\.com|openai\.com|blackbox\.ai|perplexity(?:\.ai)?|copy\.ai|jasper\.ai|copilot\.microsoft\.com|gemini\.google\.com|(?:\w+\.)?mistral\.ai|deepseek\.com|edgepilot|edgeservices|nimble\.ai|iask\.ai|aitastic\.app|bnngpt\.com|writesonic\.com|exa\.ai|waldo|cohere\.ai|huggingface\.co|anthropic\.com|chatglm\.cn|baichuan-ai\.com|zhipu\.ai|palm-ai\.google\.com|gemini-api\.google\.com|xiaoice\.com|quora\.com/poe|my-ai\.snapchat\.com|deepl\.com|you\.com|yiyan\.baidu\.com|ai\.baidu\.com|anthropic-api\.com|open-assistant\.io|huggingchat\.com|forefront\.ai|character\.ai|chat\.suno\.com|deepmind\.com|phind\.com|pi\.ai|komo\.ai|vicuna\.ai|firefly\.adobe\.com|grok\.x\.com|coze\.com|x\.ai|bard\.google\.com|lighton\.ai|spellbook\.rossintelligence\.com|notion\.so/ai|wordtune\.com|syntesia\.io|hyperwriteai\.com|sap\.ai|reka\.ai|app\.loora\.ai|uminal\.org|alphacode\.google\.com|ai21\.com|openrouter\.ai|magical\.team|useblackbox\.io|ai-coustics\.com|chinchilla\.ai|d-id\.com|wav\.ai|openchat\.so|floydhub\.com|bing\.com/chat|copilot\.azure\.com|turing\.microsoft\.com|cosmos\.microsoft\.com|orca\.microsoft\.com|phi\.microsoft\.com|megatron\.microsoft\.com|jarvis\.microsoft\.com|maia\.microsoft\.com|palm\.google\.com|deeplearning\.google\.com|vertexai\.google\.com|ai\.google\.com|deepmind\.google\.com|cloud\.google\.com/ai|cloud\.google\.com/vertex-ai|research\.google\.com/ai|ml\.googleapis\.com|tensor\.google\.com|t5\.google\.com|alice\.yandex\.ru|giga\.chat)$
A similar regular expression for traffic sources in Yandex Metrica syntax: ~(?:chatgpt\.com|chat-gpt\.org|claude\.ai|quillbot\.com|openai\.com|blackbox\.ai|perplexity(?:\.ai)?|copy\.ai|jasper\.ai|copilot\.microsoft\.com|gemini\.google\.com|(?:\w+\.)?mistral\.ai|deepseek\.com|edgepilot|edgeservices|nimble\.ai|iask\.ai|aitastic\.app|bnngpt\.com|writesonic\.com|exa\.ai|waldo|cohere\.ai|huggingface\.co|anthropic\.com|chatglm\.cn|baichuan-ai\.com|zhipu\.ai|palm-ai\.google\.com|gemini-api\.google\.com|xiaoice\.com|quora\.com/poe|my-ai\.snapchat\.com|deepl\.com|you\.com|yiyan\.baidu\.com|ai\.baidu\.com|anthropic-api\.com|open-assistant\.io|huggingchat\.com|forefront\.ai|character\.ai|chat\.suno\.com|deepmind\.com|phind\.com|pi\.ai|komo\.ai|vicuna\.ai|firefly\.adobe\.com|grok\.x\.com|coze\.com|x\.ai|bard\.google\.com|lighton\.ai|spellbook\.rossintelligence\.com|notion\.so/ai|wordtune\.com|syntesia\.io|hyperwriteai\.com|sap\.ai|reka\.ai|app\.loora\.ai|uminal\.org|alphacode\.google\.com|ai21\.com|openrouter\.ai|magical\.team|useblackbox\.io|ai-coustics\.com|chinchilla\.ai|d-id\.com|wav\.ai|openchat\.so|floydhub\.com|bing\.com/chat|copilot\.azure\.com|turing\.microsoft\.com|cosmos\.microsoft\.com|orca\.microsoft\.com|phi\.microsoft\.com|megatron\.microsoft\.com|jarvis\.microsoft\.com|maia\.microsoft\.com|palm\.google\.com|deeplearning\.google\.com|vertexai\.google\.com|ai\.google\.com|deepmind\.google\.com|cloud\.google\.com/ai|cloud\.google\.com/vertex-ai|research\.google\.com/ai|ml\.googleapis\.com|tensor\.google\.com|t5\.google\.com|alice\.yandex\.ru|giga\.chat)
The AI systems market is actively developing, and new tools with their own audiences regularly appear, so we recommend checking independently that all popular services you are interested in are included in this list.
Long search queries (50+ characters): ^[\w\W\s\S]{50,}$
Multi-word search queries (7+ words): (\w+\s){7,}\w+
Long page URLs (120+ characters): ^[\w\W\s\S]{120,}$
Mention of URLs in search queries: (?i)\b(https?://|www\.)\S+
Mention of email addresses in queries: (?i)\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b
Mention of numbers in search queries: \b\d{2,}\b
Mention of phone numbers in queries: \b(?:+?\d{1,3})?[-.\s]?$?\d{3}$?[-.\s]?\d{3}[-.\s]?\d{4}\b
Yes, analytics systems have technical limitations on regular expression length: Google Search Console — 4096 characters, Google Analytics 4 — 256 characters, Yandex Metrica — 10,000 characters.
When working with popular websites, you often run into segmentation limitations in analytics services. Using this tool, you can easily bypass all such limitations, obtaining more accurate data on branded, non-branded, and informational traffic.