Page Summary
-
The Google Ads Query Language uses operators to filter data, with case sensitivity varying between them.
-
Most string value operators are case sensitive, except for
LIKE, which is case insensitive. -
REGEXP_MATCHandNOT REGEXP_MATCHare case sensitive by default but can be made case insensitive using(?i).
The Google Ads Query Language lets you filter the returned dataset with several different operators. When you filter on string values, the case sensitivity of each operator determines how your results are matched.
Operator case sensitivity
| Operator | Case sensitivity |
|---|---|
= or != |
Case sensitive |
IN or NOT IN |
Case sensitive |
LIKE or NOT LIKE |
Case insensitive |
CONTAINS ALL, CONTAINS ANY, CONTAINS NONE |
Case sensitive |
REGEXP_MATCH or NOT REGEXP_MATCH |
Case sensitive by default (configurable) |
Examples
The following examples illustrate how different operators handle string casing in Google Ads Query Language.
Case-insensitive regular expression
The following query uses (?i) to match campaign names containing "test",
"Test", "TEST", or any other casing variation:
SELECT
campaign.id,
campaign.name
FROM campaign
WHERE campaign.name REGEXP_MATCH "(?i).*test.*"
Exact and pattern matching
- Case-sensitive exact match:
WHERE campaign.name = 'Search Campaign'matches only the exact casing. - Case-insensitive pattern match:
WHERE campaign.name LIKE '%search campaign%'matches'SEARCH CAMPAIGN','search campaign', or'Search Campaign'.