Push the boundaries of what DataForSEO can do
Learn about the latest updates

Subscribe To Our Newsletter

Back

New: not_regex operator in DataForSEO APIs

May,13 2024 13:58:11

Backlinks API
Content Analysis API
DataForSEO Labs API
Improvement
On-Page API
New: not_regex operator in DataForSEO APIs

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.

Embed DataForSeo widget on your website


Embed code:
Preview: