Excluding multiple words in the DataForSEO Labs API filters just got a lot easier with the introduction of the not_regex
operator.
UPD: Now also available in On-Page API, Backlinks API, and Content Analysis API.
Here’s how it works:
Use the not_regex
operator to exclude multiple words from search queries in API response with a single filter. When setting a task, simply specify a regular expression pattern containing the words to be excluded to streamline your data filtering process.
The previously added regex
and the new not_regex
operators can be specified with string values using the RE2 regex syntax.
Examples:
➤ To filter strings containing certain keywords: ["keyword_data.keyword", "regex", "(how|what|when)"]
➤ To filter strings that do not contain specific keywords: ["keyword_data.keyword", "not_regex", "(how|what|when)"]
Previously, you had to specify a filter like this to exclude several keywords from search:
{
"filters": [
[
"keyword",
"not_like",
"%how%"
],
"and",
[
"keyword",
"not_like",
"%what%"
],
"and",
[
"keyword",
"not_like",
"%when%"
]
]
}
Now you can obtain the same results with a simplified filter in your API request:
{
"filters": [
[
"keyword",
"not_regex",
"(how|what|when)"
]
]
}
Upgrade your API experience today – incorporate the new not_regex
operator to enhance your data retrieval efficiency! To learn more about using filters, check out this Help Center article.