Hi Nirmita,

thank you for pointing me out to the Grammar Guide, but I already red it 
thorougly and could not find a precise reference on how to escape caracters 
in regular expressions. It says the regular expression uses the re2 syntax 
<https://github.com/google/re2/wiki/Syntax>, but I found out thru trial and 
error that many caracters need to be escaped as defined for the LIKE 
operator:

*To match a literal [, ], %, or _ using the LIKE operator, surround the 
character in square brackets.*

I tried the Google Ads Query Builder, but it does not seem to fully check 
regular expressions. On many occasions the query validator validated 
queries but at execution time the regular expression was invalid.

As to why I cannot use the LIKE operator, it's because I want to partial 
match many substrings, for example I'm trying to do the equivalent of:

*WHERE campaign.name <https://campaign.name/> LIKE '%Google Ads%'" OR  
campaign.name <https://campaign.name/> LIKE '%Google Analytics%'"*

but the OR is not valid as per the grammar guide. So my workaround is to 
use a regular expression with an Alternative ( "|" ):

*WHERE campaign.name <https://campaign.name/> REGEXP_MATCH ".*Google 
Ads.*|.*Google Analytics.*''*

It works fine if there is no space in the terms I'm looking for, but if 
there's a space I get the error "Request contains an invalid argument." at 
runtime.

So my question is, *what is the official way in REGEXP_MATCH to match a 
literal " " (space), so I can make that kind of query work ?  =>  ".*Google 
Ads.*|.*Google Analytics.*''*

Thanks for you help, Francis
Le mardi 26 avril 2022 à 11:57:39 UTC-4, adsapi a écrit :

> Hi,
>
> Thank you for reaching out to the Google Ads API support team.
>
> With regards to your concern, please follow the Google Ads Query Language 
> Grammar guide 
> <https://developers.google.com/google-ads/api/docs/query/grammar> as the 
> single source of truth for GAQL grammar. I would suggest using "WHERE 
> campaign.name LIKE '%Google%Ads%'" as the filter condition. Please try 
> out our Interactive Google Ads Query Builder 
> <https://developers.google.com/google-ads/api/docs/query/interactive-gaql-builder>
>  tool 
> which can help your build up GAQL query. Let me know if you have any 
> question.
>
> Thanks,
> [image: Google Logo] 
> Nirmita 
> Google Ads API Team 
>   
>
> ref:_00D1U1174p._5004Q2aNQEj:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/a08a2a11-ce87-4a9a-a6a7-0c1b566d117bn%40googlegroups.com.

Reply via email to