Result Filters
In A-Parser there is a possibility to filter results by a set of specific rules and save only the necessary data to the result.
Using filtering
Main use cases:
- Saving only those links that contain a specific string occurrence (e.g., a CMS footprint)
- Filtering a database of domains by specific parameters (e.g., Yandex SQI from 300, language RU)
- Checking the server response (e.g., 200 OK or the presence of specific headers)
- Checking if the original query is present in the snippet
- Any other use cases where it is required to limit results by specific conditions
Filters can be added in the Task Editor by clicking on the tool icon next to the required parser:

Filtering types
You can filter both single results and arrays of results. There are several types of filters:
- By equality or inequality of strings
- By presence or absence of a substring occurrence
- By matching or not matching a regular expression
- Numeric values can be filtered by greater than, less than, and equality
See also: Results representation
Features
- When filtering arrays of results, only the results that match the filter remain in the array
- When filtering simple results, if a result does not match the filter, the result for this query is skipped entirely, including when using multiple parsers
- When using two or more filters in a task, a logical AND is applied between them; in other words, the result will be saved only if it matches the conditions of all filters simultaneously
- When comparing in the value field (string, regular expression, or numeric value), you can use the Template Toolkit template engine; all variables similar to those for the General result format are available
Examples
Filtering by text on a page
Checking a database of sites for the presence of specific text on a page
As queries, we use a file with links; as a result, we get a filtered file with links where the searched text is found.
We use the
Net::HTTP parser to download the target page, saving the query (the link being checked) to the result. We filter the $data result - the content of the downloaded page, setting the filter type to Contains string and specifying the string itself:

Filtering images by size
Filtering images by resolution
Filter the height and width of the image when parsing via
SE::Google::Images, saving only those images that are larger than 500x500 pixels:

Filtering by several attributes
Filtering links by the occurrence of any of several different strings
To filter links by several different strings, we will use the ability to specify regular expressions; for this, we write several attributes via a separator:
showthread\.php
/forum/
viewtopic\.php\?t=
Note that regular expressions require escaping a number of characters

Using a query in a filter
Saving Google snippets that contain the original query
As a string for comparison, we explicitly specify [% query %] - the variable that contains the query, and select Case sensitive to search for the substring considering the character case:
