Quick answer: Match multiple values in Looker Studio
To match multiple values in a Looker Studio calculated field, separate the alternatives with a pipe (|). REGEXP_MATCH normally matches the entire field value, while REGEXP_CONTAINS can match text anywhere inside it.
For a Source field containing exactly google, bing or yahoo, use:
REGEXP_MATCH(LOWER(Source), '(google|bing|yahoo)')
For entries such as google / organic or paid-google, use a contains check instead:
REGEXP_CONTAINS(LOWER(Source), '(google|bing|yahoo)')
Create a traffic-source classification field
In your report or data source, choose Add a field, create a calculated field and add this formula. Replace Source with the actual field in your connector.
CASE
WHEN REGEXP_CONTAINS(LOWER(Source), '(google|bing|yahoo)')
THEN 'Search engines'
ELSE 'Other sources'
END
Test the output against a small table of known values. A string such as mygoogleexample will also match the contains expression, so use an exact match or stronger boundaries if you only want actual engine names.
REGEXP_MATCH vs REGEXP_CONTAINS: which one?
| Input value | Exact REGEXP_MATCH | REGEXP_CONTAINS |
|---|---|---|
| True | True | |
| google / organic | False | True |
| direct | False | False |
Using .*(google|bing|yahoo).* inside REGEXP_MATCH can imitate a contains test, but REGEXP_CONTAINS is clearer. Both functions use RE2-style patterns in Looker Studio.
Read Google's REGEXP_CONTAINS and REGEXP_MATCH function references.
Fix invalid formula and blank results
- Field name: Use the actual dimension name from your data source; fields from blended sources can differ.
- Mixed types: Check whether you are comparing a text field rather than a numeric value.
- Quotes: Use standard quotation marks supported by the formula editor.
- Full match: Remember that REGEXP_MATCH may return false for extra words.
- Nulls: Decide how blank source values should be labeled.
For a related regex reporting job, use our Search Console regex brand exclusion guide. For GA4 discrepancies, see events missing from reports.
Three formulas you can reuse immediately
1. Match exact countries: If your field is named Country and each row contains a full country name, use:
REGEXP_MATCH(Country, '(India|United States|United Kingdom)')
2. Match any campaign containing an SEO term:
REGEXP_CONTAINS(LOWER(Campaign), 'seo|organic')
3. Exclude direct traffic in a CASE expression:
CASE
WHEN REGEXP_MATCH(LOWER(Source), '(direct)') THEN 'Direct'
ELSE 'Other'
END
Each formula assumes the named field exists in your data source. The expressions are purposefully simple and easy to test. For a large dataset, keep the pattern as narrow as practical; a broad contains rule can put unrelated campaigns into the same category.
When building a report, add a small table showing the original field alongside the calculated result. That makes false matches obvious before you use the new dimension in a client dashboard.
How to test a calculated field safely
Start with five known records rather than applying the calculation directly to a revenue chart. Include one exact match, one partial match, one blank source, one non-match and one mixed-case input. Compare each row before using the new dimension in your dashboard filters. This catches unintended matches while the impact is small.
Frequently asked questions
What does the | symbol mean?
It means “or”, allowing one expression to match several alternatives.
Does REGEXP_MATCH ignore case?
Use LOWER() on the field and lowercase alternatives so case differences cannot change the result.
Can I use this with GA4 data?
Yes, provided the connector exposes the chosen text field and supports the calculated-field function.
MTP DigiTech provides dashboard and analytics reporting support for businesses combining search and campaign data.
Need reliable analytics and conversion tracking?
We can review GA4, Tag Manager, event definitions and reporting accuracy before you optimize for leads.
Request Analytics Support →