We are trying to automate the exclusion of certain top level domains using Google Ads scripts.
We have tried different scripts (this and this) that successfully exclude domains if they contain a certain string. But CONTAINS also excludes overlapping domains, for example:
.co will also exclude .com, .co.uk, ...
We tried to use conditions, but these only take a single String and no Arrays. Therefore we have to chain them, but too many chained conditions will crash the script
Does not work
.withCondition(x DOES_NOT_CONTAIN '.com, .co.uk')
Does work (but crashes after too many chained conditions)
.withCondition(x DOES_NOT_CONTAIN '.com')
.withCondition(x DOES_NOT_CONTAIN '.co.uk')
We also tried to exclude with .co/ and .co?, but that will still allow regular .co domains.
.
So the question is, how do we exclude specific TLD's, without overlap?
For example: how do we exclude .co, without excluding .com, .co.uk, ... ?
.*(\.co$)|(.*\.co\/.*)