Hi,

I've read the documentation about the GAQL grammar 
<https://developers.google.com/google-ads/api/docs/query/overview>, however 
I cannot find an easy way to replicate AdWords' CONTAINS behavior in some 
cases.
I'm mostly interested in returning a list of campaigns that contain a 
specific substring. This substring should never be interpreted, even it has 
special characters.


For instance, let's assume we have an account with these two campaigns:
- TestCampaignProduct1Search
- [test][campaign][product2][search]

In Google AdWords I could write:
-* CampaignName CONTAINS "CampaignProduct1"* --> returns 
TestCampaignProduct1Search (ok)
- *CampaignName CONTAINS "[campaign][product2]"* --> returns 
[test][campaign][product2][search] (ok)

that worked because the squared brackets weren't interpreted as special 
characters.

In Google Ads:
- *campaign.name LIKE "%CampaignProduct1%"*  -->  returns 
TestCampaignProduct1Search (ok)
- *campaign.name LIKE "%[campaign][product2]%" -->  * 
[test][campaign][product2][search] 
is *not* matched (not ok but expected)

as pointed out in the documentation, if I want to match a square bracket 
character it needs to be surrounded by square brackets:
- *campaign.name LIKE "%[[]campaign[]][[]product2[]]%" -->  returns * 
[test][campaign][product2][search]  
(ok but "complex", especially if the Filter is exposed to the users of my 
application)

using square brackets works but it adds a complexity that I would rather 
not have.
*Isn't there an easier way to execute a search without having special 
characters interpreted?*

I read that REGEXP_MATCH uses re2 and in the re2 documentation 
<https://github.com/google/re2/wiki/Syntax> I found the  "\Q...\E" escape 
sequence that matches  "literal text ... even if ... has punctuation" but 
that doesn't seem to be supported by the API as I get an error.
Example:
*campaign.name REGEXP_MATCH ".*\Q[campaign][product2]\E.*"* --> returns
* "Request with ID "0dW9nXNyL8980lNmJJYHVQ" failed with status 
"INVALID_ARGUMENT" and includes the following errors: Error with message 
"Error in WHERE clause: invalid value ".*\.""*

How come this is invalid even though \Q...\E is listed as a valid escape 
operator?

Is there a better solution to emulate the old "CONTAINS" behavior?

Cheers


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"AdWords API and Google Ads 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/1089be35-eeb7-4ac2-bb29-d7f592aed2d2n%40googlegroups.com.
  • Ho... stefano...@webrepublic.ch
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
      • ... stefano...@webrepublic.ch
        • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
          • ... stefano...@webrepublic.ch
            • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
              • ... stefano...@webrepublic.ch
                • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to