ExtFilter

Advanced Filter. It enables you to make filters with complex conditions.

python · Community Common Scripts

Source

import demistomock as demisto  # noqa: F401
from CommonServerPython import *  # noqa: F401
import base64
import copy
import fnmatch
import hashlib
import json
import re
from email.header import decode_header
from typing import Any
from collections.abc import Callable


PATALG_BINARY: int = 0
PATALG_WILDCARD: int = 1
PATALG_REGEX: int = 2

ITERATE_NODE: int = 0
ITERATE_VALUE: int = 1
ITERATE_KEY: int = 2


class Value:
    def __init__(self, value: Any):
        self.value = value


class Ddict:
    @staticmethod
    def __search(val: dict[str, Any] | list[dict[str, Any]], comps: list[str]) -> tuple[str, Any, list[str]] | None:
        for i in range(len(comps), 0, -1):
            key = ".".join(comps[:i])

            if isinstance(val, list):
                if True not in {key in v if v else False for v in val}:
                    v = None
                else:
                    v = Value([v.get(key) if v else None for v in val])
            else:
                v = Value(val.get(key)) if key in val else None

            if v is not None:
                return (key, v.value, comps[i:])
        return None

    @staticmethod
    def search(node: dict[str, Any], path: str) -> tuple[str, Any, str] | None:
        """Get a child node

        :param node: A root node.
        :param path: A path to separete a child and names under the child.
        :return: child_name, child_value, descendant_name.
        """
        res = Ddict.__search(node, path.split("."))
        if res is None:
            return None
        return (res[0], res[1], ".".join(res[2]))

    @staticmethod
    def set(node: dict[str, Any], path: str, value: Any):
        comps = path.split(".")
        while comps:
            parent = node
            res = Ddict.__search(parent, comps)
            if res is None:
                name = comps[0]
                comps = comps[1:]
            else:
                name, node, comps = res

            if not isinstance(node, dict):
                parent[name] = node = {}
        parent[name] = value

    @staticmethod
    def get_value(node: dict[str, Any], path: str) -> Value | None:
        val = None
        key = None
        comps = path.split(".")
        while comps:
            res = Ddict.__search(node if val is None else val, comps)
            if res is None:
                return None
            key, val, comps = res

        return None if key is None else Value(val)

    @staticmethod
    def get(node: dict[str, Any], path: str) -> Any:
        val = Ddict.get_value(node, path)
        return val.value if val else None


class ContextData:
    def __init__(
        self,
        demisto: dict[str, Any] | None = None,
        inputs: dict[str, Any] | None = None,
        lists: dict[str, Any] | None = None,
        incident: dict[str, Any] | None = None,
        local: Any = None,
    ):
        self.__demisto = demisto
        self.__specials = {
            "inputs": inputs if isinstance(inputs, dict) else {},
            "lists": lists if isinstance(lists, dict) else {},
            "incident": incident if isinstance(incident, dict) else {},
            "local": delistize(local),
        }

    def get(self, key: str | None = None, node: Any | None = None) -> Any:
        """Get the context value given the key

        :param key: The dt expressions (string within ${}).
        :param node: The current node.
        :return: The value.
        """
        if key is not None:
            dx = self.__demisto
            if key != "." and not key.startswith(".=") and key.startswith("."):
                dx = delistize(node)
                key = key[1:]
            else:
                for prefix in ["inputs", "lists", "incident", "local"]:
                    if prefix == key or (key.startswith(prefix) and key[len(prefix) : len(prefix) + 1] in (".", "(", "=")):
                        dx = self.__specials
                        break
            if not key or key == ".":
                return dx
            return demisto.dt(dx, key)
        return None


class CondIterator:
    def __init__(self, conds: Any, dx: ContextData | None, node: Any):
        self.__iter = conds.__iter__()
        self.__dx = dx
        self.__node = node

    def __iter__(self):
        return self

    def __next__(self):
        cond = self.__iter.__next__()
        if isinstance(cond, list | dict):
            return cond
        else:
            return extract_value(cond, self.__dx, self.__node)


class CondItemIterator:
    def __init__(self, conds: Any, dx: ContextData | None, node: dict):
        self.__iter = conds.items().__iter__()
        self.__dx = dx
        self.__node = node

    def __iter__(self):
        return self

    def __next__(self):
        k, v = self.__iter.__next__()
        k = extract_value(k, self.__dx, self.__node)
        if isinstance(v, list | dict):
            return k, v
        else:
            return k, extract_value(v, self.__dx, self.__node)


def exit_error(err_msg: str):
    raise RuntimeError(err_msg)


def lower(value: Any, recursive: bool = False, dict_value: bool = False, dict_key: bool = False) -> Any:
    if isinstance(value, list):
        if recursive:
            return [lower(v) for v in value]
        else:
            return [v.lower() if isinstance(v, str) else v for v in value]
    elif isinstance(value, dict):
        if dict_key:
            if recursive:
                value = {lower(k, recursive, dict_value, dict_key): v for k, v in value.items()}
            else:
                value = {k.lower() if isinstance(k, str) else lower(k, False, False, False): v for k, v in value.items()}
        if dict_value:
            if recursive:
                value = {k: lower(v, recursive, dict_value, dict_key) for k, v in value.items()}
            else:
                value = {k: v.lower() if isinstance(v, str) else lower(v, False, False, False) for k, v in value.items()}
        return value
    elif isinstance(value, str):
        return value.lower()
    else:
        return value


def listize(value: Any) -> list[Any]:
    return value if isinstance(value, list) else [value]


def delistize(value: Any) -> Any:
    return value[0] if isinstance(value, list) and len(value) == 1 else value


def marshal(value: Any) -> Any:
    if isinstance(value, list):
        values = []
        for v in value:
            if isinstance(v, list):
                values.extend(v)
            else:
                values.append(v)
        return values
    elif isinstance(value, dict):
        return {k: marshal(v) for k, v in value.items()}
    else:
        return value


def iterate_value(value: Any, type: int = ITERATE_NODE, recursive: bool = False):
    if isinstance(value, list):
        for v in value:
            if recursive:
                yield from iterate_value(v, type, recursive)
            elif type != ITERATE_KEY:
                yield v

    elif isinstance(value, dict):
        if type == ITERATE_NODE:
            yield value
        else:
            for k, v in value.items():
                if type == ITERATE_KEY:
                    yield k
                    if recursive:
                        yield from iterate_value(v, type, recursive)
                else:  # ITERATE_VALUE
                    if recursive:
                        yield from iterate_value(v, type, recursive)
                    else:
                        yield v
    else:
        if type != ITERATE_KEY:
            yield value


def hashdigest(value: str, algorithm: str) -> str:
    h = hashlib.new(algorithm)
    h.update(value.encode("utf-8"))
    return h.hexdigest()


def match_pattern(pattern: str, value: Any, caseless: bool, patalg: int) -> bool:
    """Pattern matching

    :param pattern: The pattern string.
    :param value: The value to compare with the pattern.
    :param caseless: True if the pattern matching take places in case insensitive, otherwise False.
    :param patalg: The pattern matching algorithm. Spefify any of PATALG_BINARY, PATALG_WILDCARD and PATALG_REGEX.
    :return: Return True if the value matches the pattern, otherwise False.
    """
    if patalg == PATALG_BINARY:
        if caseless:
            pattern = pattern.lower()
            if isinstance(value, list):
                return next(filter(lambda v: isinstance(v, str) and v.lower() == pattern, value), None) is not None
            elif isinstance(value, str):
                return pattern == value.lower()
        else:
            if isinstance(value, list):
                return pattern in value
            elif isinstance(value, str):
                return pattern == value
        return False

    elif patalg == PATALG_WILDCARD:
        if caseless:
            pattern = pattern.lower()
            if isinstance(value, list):
                return (
                    next(filter(lambda v: isinstance(v, str) and fnmatch.fnmatchcase(v.lower(), pattern), value), None)
                    is not None
                )
            elif isinstance(value, str):
                return fnmatch.fnmatchcase(value.lower(), pattern)
        else:
            if isinstance(value, list):
                return next(filter(lambda v: isinstance(v, str) and fnmatch.fnmatchcase(v, pattern), value), None) is not None
            elif isinstance(value, str):
                return fnmatch.fnmatchcase(value, pattern)
        return False

    elif patalg == PATALG_REGEX:
        flags = re.IGNORECASE if caseless else 0

        if isinstance(value, list):
            return next(filter(lambda v: isinstance(v, str) and re.fullmatch(pattern, v, flags), value), None) is not None
        elif isinstance(value, str):
            return re.fullmatch(pattern, value, flags) is not None
        return False
    else:
        exit_error(f"Unknown pattern algorithm: '{patalg}'")
    return False


class Formatter:
    def __init__(self, start_marker: str, end_marker: str, keep_symbol_to_null: bool):
        if not start_marker:
            raise ValueError("start-marker is required.")

        self.__start_marker = start_marker
        self.__end_marker = end_marker
        self.__keep_symbol_to_null = keep_symbol_to_null

    @staticmethod
    def __is_end_mark(source: str, ci: int, end_marker: str) -> bool:
        if end_marker:
            return source[ci : ci + len(end_marker)] == end_marker
        else:
            c = source[ci]
            if c.isspace():
                return True
            elif c.isascii():
                return c != "_" and not c.isalnum()
            else:
                return False

    def __extract(
        self,
        source: str,
        extractor: Callable[[str, ContextData | None, dict[str, Any] | None], Any] | None,
        dx: ContextData | None,
        node: dict[str, Any] | None,
        si: int,
        markers: tuple[str, str] | None,
    ) -> tuple[Any, int | None]:
        """Extract a template text, or an enclosed value within starting and ending marks

        :param source: The template text, or the enclosed value starts with the next charactor of a start marker
        :param extractor: The function to extract an enclosed value as DT
        :param dx: The context data
        :param node: The current node
        :param si: The index of `source` to start extracting
        :param markers: The start and end marker to find an end position for parsing an enclosed value.
                        It must be None when the template text is given to `source`.
        :return: The extracted value and index of `source` when parsing ended.
                 The index is the next after the end marker when extracting the enclosed value.
        """
        out = None
        ci = si
        while ci < len(source):
            if markers is not None and Formatter.__is_end_mark(source, ci, markers[1]):
                key = source[si:ci] if out is None else str(out) + source[si:ci]
                if extractor:
                    if (xval := extractor(key, dx, node)) is None and self.__keep_symbol_to_null:
                        xval = markers[0] + key + markers[1]
                else:
                    xval = key
                return xval, ci + len(markers[1])
            elif extractor and source[ci : ci + len(self.__start_marker)] == self.__start_marker:
                xval, ei = self.__extract(
                    source, extractor, dx, node, ci + len(self.__start_marker), (self.__start_marker, self.__end_marker)
                )
                if si != ci:
                    out = source[si:ci] if out is None else str(out) + source[si:ci]

                if ei is None:
                    xval = self.__start_marker
                    ei = ci + len(self.__start_marker)

                if out is None:
                    out = xval
                elif xval is not None:
                    out = str(out) + str(xval)
                si = ci = ei
            elif markers is None:
                ci += 1
            elif endc := {"(": ")", "{": "}", "[": "]", '"': '"', "'": "'"}.get(source[ci]):
                _, ei = self.__extract(source, None, dx, node, ci + 1, (source[ci], endc))
                ci = ci + 1 if ei is None else ei
            elif source[ci] == "\\":
                ci += 2
            else:
                ci += 1

        if markers is not None:
            # unbalanced braces, brackets, quotes, etc.
            return None, None
        elif not extractor:
            return None, ci
        elif si >= len(source):
            return out, ci
        elif out is None:
            return source[si:], ci
        else:
            return str(out) + source[si:], ci

    def build(
        self,
        template: Any,
        extractor: Callable[[str, ContextData | None, dict[str, Any] | None], Any] | None,
        dx: ContextData | None,
        node: dict[str, Any] | None,
    ) -> Any:
        """Format a text from a template including DT expressions

        :param template: The template.
        :param extractor: The extractor to get real value within ${dt}.
        :param dx: The context instance.
        :param node: The current node.
        :return: The text built from the template.
        """
        if isinstance(template, dict):
            return {self.build(k, extractor, dx, node): self.build(v, extractor, dx, node) for k, v in template.items()}
        elif isinstance(template, list):
            return [self.build(v, extractor, dx, node) for v in template]
        elif isinstance(template, str):
            return self.__extract(template, extractor, dx, node, 0, None)[0] if template else ""
        else:
            return template


def extract_dt(dtstr: str, dx: ContextData | None, node: dict[str, Any] | None = None) -> Any:
    """Extract dt expression

    :param dtstr: The dt expressions (string within ${}).
    :param dx: The context instance.
    :param node: The current node.
    :return: The value extracted.
    """
    try:
        return dx.get(dtstr, node) if dx else dtstr
    except Exception as err:
        demisto.debug(f'failed to extract dt from "{dtstr=}". Error: {err}')
        return None


def extract_value(source: Any, dx: ContextData | None, node: dict[str, Any] | None = None) -> Any:
    """Extract value including dt expression

    :param source: The value to be extracted that may include dt expressions.
    :param dx: The demisto context.
    :param node: The current node.
    :return: The value extracted.
    """
    return Formatter("${", "}", False).build(source, extract_dt, dx, node)


def get_parent_child(
    root: dict, path: str
) -> (
    tuple[tuple[None, None], tuple[None, None]]
    | tuple[tuple[dict, None], tuple[Any, str]]
    | tuple[tuple[Any, str], tuple[Any, str]]
):
    """Get first and second level node

    :param root: The root node.
    :param path: The path to identify the leaf node.
    :return: (
      (
        parent node: The first level node in the hierarchy of the path
        parent path: The path based on the root node
      )
      (
        child node: The second level node in the hierarchy of the path
        child path: The path based on the parent node
      )
    )
    """
    res = Ddict.search(root, path)
    if res is None:
        if "." not in path:
            return (None, None), (None, None)
        else:
            child = Ddict.get(root, path)
            return (root, None), (child, path)

    parent_name, parent_value, child_name = res
    if child_name:
        child_value = Ddict.get(parent_value, child_name)
        return (parent_value, parent_name), (child_value, child_name)
    else:
        return (root, None), (parent_value, parent_name)


class ExtFilter:
    def __init__(self, dx: ContextData):
        self.__dx = dx

    def __conds_iter(self, conds: list, node: Any) -> CondIterator:
        return CondIterator(conds, self.__dx, node)

    def __conds_items(self, conds: dict, node: Any) -> CondItemIterator:
        return CondItemIterator(conds, self.__dx, node)

    def __conds_extract_keys(self, conds: dict[str, Any], node: Any) -> dict[str, Any]:
        return {extract_value(k, self.__dx, node): v for k, v in conds.items()}

    def match_value(self, lhs: Any, optype: str, rhs: Any) -> bool:
        """Matching with the conditional operator

        :param self: This instance.
        :param lhs: The left hand side value
        :param optype: The conditional operator
        :param rhs: The right hand side value
        :return: Return True if the lhs matches the rhs, otherwise False.
        """
        if optype == "is":
            if not isinstance(rhs, str):
                return False
            if rhs == "empty":
                return not bool(lhs)
            elif rhs == "null":
                return lhs is None
            elif rhs == "string":
                return isinstance(lhs, str)
            elif rhs == "integer":
                return isinstance(lhs, int)
            elif rhs == "integer string":
                try:
                    return isinstance(int(lhs, 10), int)
                except (ValueError, TypeError):
                    return False
            elif rhs == "any integer":
                try:
                    return isinstance(lhs, int) or isinstance(int(lhs, 10), int)
                except (ValueError, TypeError):
                    return False
            exit_error(f"Unknown operation filter: '{rhs}'")

        elif optype == "isn't":
            return not self.match_value(lhs, "is", rhs)

        elif optype == "===":
            rhs = self.parse_conds_json(rhs)
            try:
                return isinstance(lhs, type(rhs)) and lhs == rhs
            except (ValueError, TypeError):
                return False

        elif optype == "!==":
            rhs = self.parse_conds_json(rhs)
            try:
                return not isinstance(lhs, type(rhs)) or lhs != rhs
            except (ValueError, TypeError):
                return False

        elif optype in ("equals", "=="):
            try:
                if isinstance(lhs, int):
                    return lhs == int(rhs)
                elif isinstance(lhs, float):
                    return lhs == float(rhs)
                elif isinstance(lhs, str):
                    return lhs == str(rhs)
                else:
                    return lhs == rhs
            except (ValueError, TypeError):
                pass
            return False

        elif optype in ("doesn't equal", "!="):
            return not self.match_value(lhs, "equals", rhs)

        elif optype in ("greater or equal", ">="):
            try:
                return float(lhs) >= float(rhs)
            except (ValueError, TypeError):
                pass
            return False

        elif optype in ("greater than", ">"):
            try:
                return float(lhs) > float(rhs)
            except (ValueError, TypeError):
                pass
            return False

        elif optype in ("less or equal", "<="):
            try:
                return float(lhs) <= float(rhs)
            except (ValueError, TypeError):
                pass
            return False

        elif optype in ("less than", "<"):
            try:
                return float(lhs) < float(rhs)
            except (ValueError, TypeError):
                pass
            return False

        elif optype == "in":
            return lhs in listize(rhs)

        elif optype == "not in":
            return lhs not in listize(rhs)

        elif optype == "in caseless":
            return lower(lhs, True, True) in listize(lower(rhs, True, True))

        elif optype == "not in caseless":
            return lower(lhs, True, True) not in listize(lower(rhs, True, True))

        elif optype == "in range":
            if not isinstance(rhs, str):
                return False

            minmax = rhs.split(",")
            if len(minmax) != 2:
                exit_error(f"Invalid Range: {rhs}")

            try:
                lhs = float(lhs)
            except (ValueError, TypeError):
                return False
            return float(minmax[0]) <= lhs and lhs <= float(minmax[1])

        elif optype == "starts with":
            return isinstance(rhs, str) and isinstance(lhs, str) and lhs.startswith(rhs)

        elif optype == "starts with caseless":
            return isinstance(rhs, str) and isinstance(lhs, str) and lhs.lower().startswith(rhs.lower())

        elif optype == "doesn't start with":
            return not self.match_value(lhs, "starts with", rhs)

        elif optype == "doesn't start with caseless":
            return not self.match_value(lhs, "starts with caseless", rhs)

        elif optype == "ends with":
            return isinstance(rhs, str) and isinstance(lhs, str) and lhs.endswith(rhs)

        elif optype == "ends with caseless":
            return isinstance(rhs, str) and isinstance(lhs, str) and lhs.lower().endswith(rhs.lower())

        elif optype == "doesn't end with":
            return not self.match_value(lhs, "ends with", rhs)

        elif optype == "doesn't end with caseless":
            return not self.match_value(lhs, "ends with caseless", rhs)

        elif optype == "includes":
            return isinstance(rhs, str) and isinstance(lhs, str) and rhs in lhs

        elif optype == "includes caseless":
            return isinstance(rhs, str) and isinstance(lhs, str) and rhs.lower() in lower(lhs)

        elif optype == "doesn't include":
            return not self.match_value(lhs, "includes", rhs)

        elif optype == "doesn't include caseless":
            return not self.match_value(lhs, "includes caseless", rhs)

        elif optype == "matches":
            return isinstance(rhs, str) and isinstance(lhs, str) and lhs == rhs

        elif optype == "matches caseless":
            return isinstance(rhs, str) and isinstance(lhs, str) and lhs.lower() == rhs.lower()

        elif optype == "doesn't match":
            return not self.match_value(lhs, "matches", rhs)

        elif optype == "doesn't match caseless":
            return not self.match_value(lhs, "matches caseless", rhs)

        elif optype == "wildcard: matches":
            return isinstance(rhs, str) and match_pattern(rhs, lhs, False, PATALG_WILDCARD)

        elif optype == "wildcard: matches caseless":
            return isinstance(rhs, str) and match_pattern(rhs, lhs, True, PATALG_WILDCARD)

        elif optype == "wildcard: doesn't match":
            return not isinstance(rhs, str) or not match_pattern(rhs, lhs, False, PATALG_WILDCARD)

        elif optype == "wildcard: doesn't match caseless":
            return not isinstance(rhs, str) or not match_pattern(rhs, lhs, True, PATALG_WILDCARD)

        elif optype == "regex: matches":
            return isinstance(rhs, str) and match_pattern(rhs, lhs, False, PATALG_REGEX)

        elif optype == "regex: matches caseless":
            return isinstance(rhs, str) and match_pattern(rhs, lhs, True, PATALG_REGEX)

        elif optype == "regex: doesn't match":
            return not isinstance(rhs, str) or not match_pattern(rhs, lhs, False, PATALG_REGEX)

        elif optype == "regex: doesn't match caseless":
            return not isinstance(rhs, str) or not match_pattern(rhs, lhs, True, PATALG_REGEX)

        elif optype == "in list":
            return isinstance(rhs, str) and isinstance(lhs, str) and lhs in rhs.split(",")

        elif optype == "in caseless list":
            return isinstance(rhs, str) and isinstance(lhs, str) and lhs.lower() in rhs.lower().split(",")

        elif optype == "not in list":
            return not self.match_value(lhs, "in list", rhs)

        elif optype == "not in caseless list":
            return not self.match_value(lhs, "in caseless list", rhs)

        elif optype == "matches any line of":
            return isinstance(rhs, str) and isinstance(lhs, str) and lhs in rhs.splitlines()

        elif optype == "matches any caseless line of":
            if not isinstance(rhs, str) or not isinstance(lhs, str):
                return False

            lhs = lhs.lower()
            return next(filter(lambda x: isinstance(x, str) and x.lower() == lhs, rhs.splitlines()), None) is not None

        elif optype == "doesn't match any line of":
            return not self.match_value(lhs, "matches any line of", rhs)

        elif optype == "doesn't match any caseless line of":
            return not self.match_value(lhs, "matches any caseless line of", rhs)

        elif optype == "matches any string of":
            if not isinstance(lhs, str):
                return False

            return lhs in listize(self.parse_conds_json(rhs))

        elif optype == "matches any caseless string of":
            if not isinstance(lhs, str):
                return False

            return (
                next(
                    filter(
                        lambda r: isinstance(r, str) and match_pattern(r, lhs, True, PATALG_BINARY),
                        listize(self.parse_conds_json(rhs)),
                    ),
                    None,
                )
                is not None
            )

        elif optype == "doesn't match any string of":
            return not self.match_value(lhs, "matches any string of", rhs)

        elif optype == "doesn't match any caseless string of":
            return not self.match_value(lhs, "matches any caseless string of", rhs)

        elif optype == "wildcard: matches any string of":
            if not isinstance(lhs, str):
                return False

            return (
                next(
                    filter(
                        lambda r: isinstance(r, str) and match_pattern(r, lhs, False, PATALG_WILDCARD),
                        listize(self.parse_conds_json(rhs)),
                    ),
                    None,
                )
                is not None
            )

        elif optype == "wildcard: matches any caseless string of":
            if not isinstance(lhs, str):
                return False

            return (
                next(
                    filter(
                        lambda r: isinstance(r, str) and match_pattern(r, lhs, True, PATALG_WILDCARD),
                        listize(self.parse_conds_json(rhs)),
                    ),
                    None,
                )
                is not None
            )

        elif optype == "wildcard: doesn't match any string of":
            return not self.match_value(lhs, "wildcard: matches any string of", rhs)

        elif optype == "wildcard: doesn't match any caseless string of":
            return not self.match_value(lhs, "wildcard: matches any caseless string of", rhs)

        elif optype == "regex: matches any string of":
            if not isinstance(lhs, str):
                return False

            return (
                next(
                    filter(
                        lambda r: isinstance(r, str) and match_pattern(r, lhs, False, PATALG_REGEX),
                        listize(self.parse_conds_json(rhs)),
                    ),
                    None,
                )
                is not None
            )

        elif optype == "regex: matches any caseless string of":
            if not isinstance(lhs, str):
                return False

            return (
                next(
                    filter(
                        lambda r: isinstance(r, str) and match_pattern(r, lhs, True, PATALG_REGEX),
                        listize(self.parse_conds_json(rhs)),
                    ),
                    None,
                )
                is not None
            )

        elif optype == "regex: doesn't match any string of":
            return not self.match_value(lhs, "regex: matches any string of", rhs)

        elif optype == "regex: doesn't match any caseless string of":
            return not self.match_value(lhs, "regex: matches any caseless string of", rhs)

        else:
            exit_error(f"Unknown operation name: '{optype}'")
        return False

    def filter_with_expressions(
        self, root: Any, conds: dict | list, path: str | None = None, inlist: bool = False
    ) -> Value | None:
        """Filter the value with the conditions

        *** NOTE ***
        condition: root == 1 or ( root > 10 and root < 20 )
        expression:
        [
          {'==': 1},
          'or',
          {'>': 10, '<': 20}
        ]

        condition: root isn't integer or ( root == 1 or ( root > 10 and root < 20 ) )
        expression:
        [
          [
            {"isn't": 'integer'}
          ],
          'or',
          [
            {'==': 1},
            'or',
            {'>': 10, '<': 20}
          ]
        ]

        :param self: This instance.
        :param root: The value to filter.
        :param conds: The expressions to filter the value.
        :param path: The path to apply the conditions.
        :param inlist: True if `root` is an element in a list, False otherwise.
        :return: Return the filtered value in Value object if the conditions matches it, otherwise None.
        """
        if isinstance(conds, dict):
            # AND conditions
            parent = None
            child = root
            if path:
                if isinstance(root, list):
                    return Value([v.value for v in [self.filter_with_expressions(r, conds, path, True) for r in root] if v])
                elif not isinstance(root, dict):
                    return None
                (parent, parent_path), (child, child_name) = get_parent_child(root, path)
            else:
                child_name = ""
                parent_path = ""
                demisto.debug(f"{path=} -> {child_name=} {parent_path=}")

            for x in self.__conds_items(conds, root):
                coptype, cconds = x

                if coptype in ("is", "isn't") and isinstance(cconds, str) and cconds == "existing key":
                    if (coptype == "is") != bool(path and Ddict.get_value(root, path)):
                        return None
                else:
                    child = self.filter_value(child, coptype, cconds, None, inlist and parent is None)
                    if not child:
                        return None
                    child = child.value

                if parent:
                    if isinstance(parent, dict):
                        if not isinstance(child_name, str):
                            exit_error("Internal error: no child_name")
                        else:
                            Ddict.set(parent, child_name, child)
                    else:
                        Ddict.set(root, parent_path, child)
                elif not path:
                    root = child

            return Value(root)

        elif isinstance(conds, list):
            # AND conditions by default
            ok, lop, neg = (None, None, None)
            for x in self.__conds_iter(conds, root):
                if isinstance(x, str):
                    if x == "not":
                        neg = not neg
                    elif lop is None and neg is None:
                        lop = x
                    else:
                        exit_error("Invalid logical operators syntax")
                elif isinstance(x, dict | list):
                    val = None
                    if ok is None:
                        val = self.filter_with_expressions(root, x, path, inlist)
                        ok = bool(val) ^ (neg or False)
                    elif lop is None or lop == "and":
                        val = self.filter_with_expressions(root, x, path, inlist)
                        ok = ok and (bool(val) ^ (neg or False))
                    elif lop == "or":
                        val = self.filter_with_expressions(root, x, path, inlist)
                        ok = ok or (bool(val) ^ (neg or False))
                    else:
                        exit_error(f"Invalid logical operator: {lop}")
                    lop, neg = (None, None)
                    root = val.value if val else root
                else:
                    exit_error(f"Invalid conditions format: {x}")
            return Value(root) if ok is None or ok else None
        else:
            exit_error(f"Invalid conditions format: {conds}")
        return None

    def filter_with_conditions(self, root: Any, conds: dict | list) -> Value | None:
        """Filter the value with the conditions

        *** NOTE ***
        expression for 'conds':
        [
          {
            "path1": <expression> for filter_with_expressions(),
            "path2": <expression> for filter_with_expressions()
            :
          }
          'or',
          [
            'not',
            {
              "path3": <expression> for filter_with_expressions(),
              "path4": <expression> for filter_with_expressions()
              :
            },
            'or',
            {
              "path5": <expression> for filter_with_expressions(),
              "path6": <expression> for filter_with_expressions()
              :
            }
          }
        ]

        :param self: This instance.
        :param root: The value to filter.
        :param conds: The condition expression to filter the value.
        :return: Return the filtered value in Value object if the conditions matches it, otherwise None.
        """
        if isinstance(conds, dict):
            # AND conditions
            for x in self.__conds_items(conds, root):
                if len(x) < 2 or isinstance(x[0], dict | list):
                    exit_error(f"Invalid conditions format: {x}")

                root = self.filter_with_expressions(root, x[1], x[0])
                if not root:
                    return None
                root = root.value
            return Value(root)
        elif isinstance(conds, list):
            # AND conditions by default
            ok, lop, neg = (None, None, None)
            for x in self.__conds_iter(conds, root):
                if isinstance(x, str):
                    if x == "not":
                        neg = not neg
                    elif lop is None and neg is None:
                        lop = x
                    else:
                        exit_error("Invalid logical operators syntax")
                elif isinstance(x, dict | list):
                    val = None
                    if ok is None:
                        val = self.filter_with_conditions(root, x)
                        ok = bool(val) ^ (neg or False)
                    elif lop is None or lop == "and":
                        val = self.filter_with_conditions(root, x)
                        ok = ok and (bool(val) ^ (neg or False))
                    elif lop == "or":
                        val = self.filter_with_conditions(root, x)
                        ok = ok or (bool(val) ^ (neg or False))
                    else:
                        exit_error(f"Invalid logical operator: {lop}")
                    lop, neg = (None, None)
                    root = val.value if val else root
                else:
                    exit_error(f"Invalid conditions format: {x}")
            return Value(root) if ok is None or ok else None
        else:
            exit_error(f"Invalid conditions format: {conds}")
        return None

    def filter_values(self, root: list[Any], optype: str, conds: Any, path: str | None = None) -> Value | None:
        """Filter values of a list with the conditions

        :param self: This instance.
        :param root: The values to filter.
        :param optype: The conditional operator.
        :param conds: The condition expression to filter the value.
        :param path: The path to apply the conditions.
        :return: Return the filtered value in Value object if the conditions matches it, otherwise None.
        """
        return Value([v.value for v in [self.filter_value(r, optype, conds, path, True) for r in root] if v])

    def filter_value(self, root: Any, optype: str, conds: Any, path: str | None = None, inlist: bool = False) -> Value | None:
        """Filter the value with the conditions

        :param self: This instance.
        :param root: The value to filter.
        :param optype: The conditional operator.
        :param conds: The condition expression to filter the value.
        :param path: The path to apply the conditions.
        :param inlist: True if `root` is an element in a list, False otherwise.
        :return: Return the filtered value in Value object if the conditions matches it, otherwise None.
        """
        if optype == "abort":
            exit_error(f"ABORT: value = {root}, conds = {conds}, path = {path}")

        elif optype == "is collectively transformed with":
            return self.filter_value(root, "is transformed with", conds, path, True)

        elif optype == "is transformed with":
            conds = listize(self.parse_conds_json(conds))

            for operation in self.__conds_iter(conds, root):
                if not isinstance(operation, dict):
                    exit_error(f"Invalid condition format: {operation}")

                for k, v in self.__conds_items(operation, root):
                    value = self.filter_value(root, k, v, path, inlist)
                    root = None if value is None else value.value

            return Value(root)

        elif optype == "is filtered with":
            if not inlist and isinstance(root, list):
                return self.filter_values(root, optype, conds, path)

            if path:
                conds = {"matches conditions of": self.parse_conds_json(conds)}
                if isinstance(root, dict):
                    return self.filter_with_expressions(root, conds, path, inlist)
                else:
                    return None
            else:
                return self.filter_value(root, "matches conditions of", conds)

        elif optype == "value is filtered with":
            if not inlist and isinstance(root, list):
                return self.filter_values(root, optype, conds, path)

            conds = self.parse_conds_json(conds)
            if path:
                conds = {"value matches expressions of": conds}
                if isinstance(root, dict):
                    v = {
                        k: v
                        for k, f, v in [(k, self.filter_with_expressions(v, conds, path, False), v) for k, v in root.items()]
                        if f and f.value
                    }
                    return Value(v) if v else None
                else:
                    return self.filter_with_expressions(root, conds, path, inlist)
            else:
                if isinstance(root, dict):
                    v = {
                        k: v
                        for k, f, v in [(k, self.filter_with_expressions(v, conds, None, False), v) for k, v in root.items()]
                        if f and f.value
                    }
                    return Value(v) if v else None
                else:
                    return self.filter_with_expressions(root, conds, None, inlist)

        elif optype in ("is", "isn't"):
            if not inlist and isinstance(root, list):
                return self.filter_values(root, optype, conds, path)

            if isinstance(conds, str) and conds == "existing key":
                if (optype == "is") == bool(path and Ddict.get_value(root, path)):
                    return Value(root)
                return None

        if path:
            if not inlist and isinstance(root, list):
                return self.filter_values(root, optype, conds, path)

            conds = {optype: self.parse_conds_json(conds)}
            if isinstance(root, dict | list):
                return self.filter_with_expressions(root, conds, path, inlist)
            else:
                return None

        elif optype == "if-then-else":
            if not inlist and isinstance(root, list):
                return self.filter_values(root, optype, conds, path)

            conds = self.parse_conds_json(conds)
            if not isinstance(conds, dict):
                exit_error(f"Invalid conditions: {conds}")

            conds = self.__conds_extract_keys(conds, root)

            lconds = conds.get("if")
            if lconds:
                lhs = conds.get("lhs")
                if lhs is None:
                    lhs = copy.deepcopy(root)
                else:
                    lhs = self.parse_and_extract_conds_json(lhs, root)

                lconds = self.parse_conds_json(lconds)
                if not isinstance(lconds, dict | list):
                    exit_error(f"Invalid conditions: {lconds}")

                elif self.filter_with_expressions(lhs, lconds, path, inlist) is None:
                    lconds = conds.get("else")
                else:
                    lconds = conds.get("then")
            else:
                lconds = conds.get("then")

            if lconds:
                lconds = self.parse_conds_json(lconds)
                if not isinstance(lconds, dict | list):
                    exit_error(f"Invalid conditions: {lconds}")

                return self.filter_with_expressions(root, lconds, path, inlist)
            else:
                return Value(root)

        elif optype == "switch-case":
            if not inlist and isinstance(root, list):
                return self.filter_values(root, optype, conds, path)

            conds = self.parse_conds_json(conds)
            if not isinstance(conds, dict):
                exit_error(f"Invalid conditions: {conds}")

            conds = self.__conds_extract_keys(conds, root)

            label = "default"
            lconds = conds.get("switch")
            if lconds:
                for lexps in iterate_value(self.parse_conds_json(lconds)):
                    if not isinstance(lexps, dict):
                        exit_error(f"Invalid conditions: {lexps}")

                    for k, v in lexps.items():
                        if not isinstance(v, dict):
                            exit_error(f"Invalid conditions: {lconds}")

                        if self.filter_with_expressions(root, v, path, inlist):
                            label = k
                            break
                    else:
                        continue
                    break

            lconds = conds.get(label)
            if lconds:
                lconds = self.parse_conds_json(lconds)
                if not isinstance(lconds, dict | list):
                    exit_error(f"Invalid conditions: {lconds}")

                return self.filter_with_expressions(root, lconds, path, inlist)
            else:
                return Value(root)

        elif optype == "keeps":
            if not inlist and isinstance(root, list):
                return self.filter_values(root, optype, conds, path)

            conds = self.parse_conds_json(conds)
            if not isinstance(root, dict) and not isinstance(conds, list):
                return None

            return Value({k: v for k, v in root.items() if k in list(self.__conds_iter(conds, v))})

        elif optype == "doesn't keep":
            if not inlist and isinstance(root, list):
                return self.filter_values(root, optype, conds, path)

            conds = self.parse_conds_json(conds)
            if not isinstance(root, dict) or not isinstance(conds, list):
                return None

            return Value({k: v for k, v in root.items() if k not in list(self.__conds_iter(conds, v))})

        elif optype == "matches expressions of":
            if not inlist and isinstance(root, list):
                return self.filter_values(root, optype, conds, path)

            conds = self.parse_conds_json(conds)
            return self.filter_with_expressions(root, conds, path, inlist)

        elif optype == "matches conditions of":
            if not inlist and isinstance(root, list):
                return self.filter_values(root, optype, conds, path)

            conds = self.parse_conds_json(conds)
            return self.filter_with_conditions(root, conds)

        elif optype == "value matches expressions of":
            if not inlist and isinstance(root, list):
                return self.filter_values(root, optype, conds, path)

            conds = self.parse_conds_json(conds)
            if isinstance(root, dict):
                v = {
                    k: v.value
                    for k, v in {k: self.filter_with_expressions(v, conds, None, False) for k, v in root.items()}.items()
                    if v
                }
                return Value(v) if v else None
            else:
                return self.filter_with_expressions(root, conds, None, inlist)

        elif optype == "value matches conditions of":
            if not inlist and isinstance(root, list):
                return self.filter_values(root, optype, conds, path)

            conds = self.parse_conds_json(conds)
            if isinstance(root, dict):
                v = {k: v.value for k, v in {k: self.filter_with_conditions(v, conds) for k, v in root.items()}.items() if v}
                return Value(v) if v else None
            else:
                return self.filter_with_conditions(root, conds)

        elif optype == "collects values":
            if not inlist and isinstance(root, list):
                return self.filter_values(root, optype, conds, path)

            if isinstance(root, list | dict):
                return Value(list(iterate_value(root, ITERATE_VALUE)))
            else:
                return Value(root)

        elif optype == "collects keys":
            if not inlist and isinstance(root, list):
                return self.filter_values(root, optype, conds, path)

            if isinstance(root, list | dict):
                return Value(list(iterate_value(root, ITERATE_KEY)))
            else:
                return None

        elif optype == "flattens with values":
            if isinstance(root, list | dict):
                return Value(list(iterate_value(root, ITERATE_VALUE, True)))
            else:
                return Value(root)

        elif optype == "flattens with keys":
            if isinstance(root, list | dict):
                return Value(list(iterate_value(root, ITERATE_KEY, True)))
            else:
                return None

        """
        Filter for an entire value
        """
        if optype == "finds":
            rhs = self.extract_value(conds, root)
            lhs = root
            ok = False
            try:
                if isinstance(rhs, str):
                    if isinstance(lhs, list):
                        ok = any(isinstance(v, str) and rhs in v for v in lhs)
                    elif isinstance(lhs, str):
                        ok = rhs in lhs
            except (ValueError, TypeError):
                pass
            return Value(root) if ok else None

        elif optype == "finds caseless":
            rhs = self.extract_value(conds, root)
            lhs = root
            ok = False
            try:
                if isinstance(rhs, str):
                    if isinstance(lhs, list):
                        ok = any(isinstance(v, str) and rhs.lower() in v for v in lower(lhs))
                    elif isinstance(lhs, str):
                        ok = rhs.lower() in lower(lhs)
            except (ValueError, TypeError):
                pass
            return Value(root) if ok else None

        elif optype == "doesn't find":
            if not self.filter_value(root, "finds", conds, path):
                return Value(root)
            else:
                return None

        elif optype == "doesn't find caseless":
            if not self.filter_value(root, "finds caseless", conds):
                return Value(root)
            else:
                return None

        elif optype == "contains":
            rhs = self.extract_value(conds, root)
            lhs = listize(root)
            if rhs in lhs:
                return Value(root)
            else:
                return None

        elif optype == "contains caseless":
            rhs = self.extract_value(conds, root)
            lhs = listize(root)
            if lower(rhs, True, True) in lower(lhs, True, True):
                return Value(root)
            else:
                return None

        elif optype == "doesn't contain":
            if not self.filter_value(root, "contains", conds):
                return Value(root)
            else:
                return None

        elif optype == "doesn't contain caseless":
            if not self.filter_value(root, "contains caseless", conds):
                return Value(root)
            else:
                return None

        elif optype == "wildcard: contains":
            rhs = self.extract_value(conds, root)
            lhs = listize(root)
            if isinstance(rhs, str) and match_pattern(rhs, lhs, False, PATALG_WILDCARD):
                return Value(root)
            else:
                return None

        elif optype == "wildcard: contains caseless":
            rhs = self.extract_value(conds, root)
            lhs = listize(root)
            if isinstance(rhs, str) and match_pattern(rhs, lhs, True, PATALG_WILDCARD):
                return Value(root)
            else:
                return None

        elif optype == "wildcard: doesn't contain":
            if not self.filter_value(root, "wildcard: contains", conds):
                return Value(root)
            else:
                return None

        elif optype == "wildcard: doesn't contain caseless":
            if not self.filter_value(root, "wildcard: contains caseless", conds):
                return Value(root)
            else:
                return None

        elif optype == "regex: contains":
            rhs = self.extract_value(conds, root)
            lhs = listize(root)
            if isinstance(rhs, str) and match_pattern(rhs, lhs, False, PATALG_REGEX):
                return Value(root)
            else:
                return None

        elif optype == "regex: contains caseless":
            rhs = self.extract_value(conds, root)
            lhs = listize(root)
            if isinstance(rhs, str) and match_pattern(rhs, lhs, True, PATALG_REGEX):
                return Value(root)
            else:
                return None

        elif optype == "regex: doesn't contain":
            if not self.filter_value(root, "regex: contains", conds):
                return Value(root)
            else:
                return None

        elif optype == "regex: doesn't contain caseless":
            if not self.filter_value(root, "regex: contains caseless", conds):
                return Value(root)
            else:
                return None

        elif optype == "contains any line of":
            rhs = self.extract_value(conds, root)
            lhs = root
            if isinstance(rhs, str) and any(self.filter_value(lhs, "contains", x) for x in rhs.splitlines()):
                return Value(root)
            else:
                return None

        elif optype == "contains any caseless line of":
            rhs = self.extract_value(conds, root)
            lhs = root
            if isinstance(rhs, str) and any(self.filter_value(lhs, "contains caseless", x) for x in rhs.splitlines()):
                return Value(root)
            else:
                return None

        elif optype == "doesn't contain any line of":
            if not self.filter_value(root, "contains any line of", conds):
                return Value(root)
            else:
                return None

        elif optype == "doesn't contain any caseless line of":
            if not self.filter_value(root, "contains any caseless line of", conds):
                return Value(root)
            else:
                return None

        elif optype == "contains any string of":
            rhs = listize(self.parse_and_extract_conds_json(conds, root))
            lhs = listize(root)
            if next(filter(lambda r: isinstance(r, str) and r in lhs, rhs), None):
                return Value(root)
            else:
                return None

        elif optype == "contains any caseless string of":
            rhs = listize(self.parse_and_extract_conds_json(conds, root))
            lhs = root
            if next(filter(lambda r: isinstance(r, str) and match_pattern(r, lhs, True, PATALG_BINARY), rhs), None):
                return Value(root)
            else:
                return None

        elif optype == "doesn't contain any string of":
            return Value(root) if not self.filter_value(root, "contains any string of", conds) else None

        elif optype == "doesn't contain any caseless string of":
            return Value(root) if not self.filter_value(root, "contains any caseless string of", conds) else None

        elif optype == "wildcard: contains any string of":
            rhs = listize(self.parse_and_extract_conds_json(conds, root))
            lhs = root
            if next(filter(lambda r: isinstance(r, str) and match_pattern(r, lhs, False, PATALG_WILDCARD), rhs), None):
                return Value(root)
            else:
                return None

        elif optype == "wildcard: contains any caseless string of":
            rhs = listize(self.parse_and_extract_conds_json(conds, root))
            lhs = root
            if next(filter(lambda r: isinstance(r, str) and match_pattern(r, lhs, True, PATALG_WILDCARD), rhs), None):
                return Value(root)
            else:
                return None

        elif optype == "wildcard: doesn't contain any string of":
            if not self.filter_value(root, "wildcard: contains any string of", conds):
                return Value(root)
            else:
                return None

        elif optype == "wildcard: doesn't contain any caseless string of":
            if not self.filter_value(root, "wildcard: contains any caseless string of", conds):
                return Value(root)
            else:
                return None

        elif optype == "regex: contains any string of":
            rhs = listize(self.parse_and_extract_conds_json(conds, root))
            lhs = root
            if next(filter(lambda r: isinstance(r, str) and match_pattern(r, lhs, False, PATALG_REGEX), rhs), None):
                return Value(root)
            else:
                return None

        elif optype == "regex: contains any caseless string of":
            rhs = listize(self.parse_and_extract_conds_json(conds, root))
            lhs = root
            if next(filter(lambda r: isinstance(r, str) and match_pattern(r, lhs, True, PATALG_REGEX), rhs), None):
                return Value(root)
            else:
                return None

        elif optype == "regex: doesn't contain any string of":
            if not self.filter_value(root, "regex: contains any string of", conds):
                return Value(root)
            else:
                return None

        elif optype == "regex: doesn't contain any caseless string of":
            if not self.filter_value(root, "regex: contains any caseless string of", conds):
                return Value(root)
            else:
                return None

        elif optype == "is replaced with":
            return Value(self.parse_and_extract_conds_json(conds, root))

        elif optype == "is updated with":
            rhs = self.parse_and_extract_conds_json(conds, root)
            lhs = root
            if isinstance(lhs, dict) and isinstance(rhs, dict):
                lhs.update(copy.deepcopy(rhs))
            elif isinstance(lhs, list) and len(lhs) == 1 and isinstance(lhs[0], dict):
                lhs[0].update(copy.deepcopy(rhs))
            else:
                lhs = rhs
            return Value(lhs)

        elif optype == "appends":
            rhs = listize(self.parse_and_extract_conds_json(conds, root))
            lhs = listize(root)
            lhs.extend(rhs)
            return Value(lhs)

        elif optype == "json: encode array":
            params = self.parse_and_extract_conds_json(conds, root)
            indent = params.get("indent")
            return Value(json.dumps(root, indent=None if indent is None else int(indent)))

        """
        Filter for individual values
        """
        if not inlist and isinstance(root, list):
            return self.filter_values(root, optype, conds)

        """
        Filter for single value
        """
        if optype == "json: encode":
            params = self.parse_and_extract_conds_json(conds, root)
            indent = params.get("indent")
            return Value(json.dumps(root, indent=None if indent is None else int(indent)))

        elif optype == "json: decode":
            return Value(json.loads(str(root)))

        elif optype == "base64: encode":
            return Value(base64.b64encode(str(root).encode("utf-8")).decode("utf-8"))

        elif optype == "base64: decode":
            return Value(base64.b64decode(root.encode("utf-8")).decode("utf-8", errors="ignore"))

        elif optype == "digest":
            params = self.parse_and_extract_conds_json(conds, root)
            return Value(hashdigest(str(root), str(params.get("algorithm", "sha256"))))

        elif optype == "email-header: decode":
            lhs = root
            out = ""
            try:
                for decoded_s, encoding in decode_header(str(lhs)):
                    if encoding:
                        out += decoded_s.decode(encoding)
                    elif isinstance(decoded_s, bytes):
                        out += decoded_s.decode("utf-8")
                    else:
                        out += decoded_s
            except Exception:
                demisto.debug(f"Failed to decode by `email-header: decode`: {lhs}")
                out = str(lhs)
            return Value(out)

        elif optype == "regex: replace":
            params = self.parse_and_extract_conds_json(conds, root)
            lhs = root

            pattern = params["pattern"]
            matched = params["matched"]
            flags = 0
            flags |= re.IGNORECASE if argToBoolean(params.get("caseless", False)) else 0
            flags |= re.MULTILINE if argToBoolean(params.get("multiline", False)) else 0
            flags |= re.DOTALL if argToBoolean(params.get("dotall", False)) else 0
            match = re.fullmatch(pattern, str(lhs), flags=flags)
            if not match:
                return Value(params.get("unmatched", lhs))
            elif isinstance(matched, str):
                return Value(match.expand(matched.replace(r"\0", r"\g<0>")))
            else:
                return Value(matched)

        elif optype == "is individually transformed with":
            return self.filter_value(root, "is transformed with", conds)

        """
        Filter for single value (boolean evaluation)
        """
        rhs = self.extract_value(conds, root)
        return Value(root) if self.match_value(root, optype, rhs) else None

    def extract_value(self, source: Any, node: Any) -> Any:
        """Extract value including dt expression

        :param self: This instance.
        :param source: The value to be extracted that may include dt expressions.
        :param node: The current node.
        :return: The value extracted.
        """
        return extract_value(source, self.__dx, node)

    def parse_conds_json(self, jstr: str) -> Any:
        """parse a json string

        :param self: This instance.
        :param jstr: A json string.
        :return: The value extracted.
        """
        if not isinstance(jstr, str):
            return jstr
        try:
            return json.loads(jstr)
        except json.JSONDecodeError:
            return jstr

    def parse_and_extract_conds_json(self, jstr: str, node: Any) -> Any:
        """parse a json string and extract value

        :param self: This instance.
        :param jstr: A json string.
        :param node: The current node.
        :return: The value extracted.
        """
        return extract_value(self.parse_conds_json(jstr), self.__dx, node)


def main():
    args = demisto.args()
    try:
        value = args["value"]
        path = args.get("path", "")
        optype = args["operation"]
        conds = args["filter"]

        # Setup demisto context
        dx = args.get("ctx_demisto")
        if dx and isinstance(dx, str):
            dx = json.loads(dx)
        elif not dx:
            dx = value if isinstance(value, dict) else None
        dx = ContextData(
            demisto=dx, inputs=args.get("ctx_inputs"), lists=args.get("ctx_lists"), incident=args.get("ctx_incident"), local=value
        )

        # Extract value
        xfilter = ExtFilter(dx)
        value = xfilter.filter_value(value, optype, conds, path)
        value = value.value if value else None
        value = marshal(value)
        value = value if value is not None else []
        value = value if isinstance(value, list) else [value]
    except Exception as err:
        raise err

    demisto.results(value)


if __name__ in ("__builtin__", "builtins", "__main__"):
    main()

README

Filter values with complex conditions.

You can make filters with comlex and combination conditions for the context data at any level of the tree.


Script Data

Name Description
Script Type python
Tags transformer, entirelist, general

Inputs

Argument Name Description
value The value to filter/transform.
path Context path to which to filter
operator The operation name to filter/transform.
filter The filter.
ctx_demisto Enable to access the context data
ctx_inputs Enable to access the input parameters to sub playbooks and use ${inputs.}
ctx_lists Enable to access the list data and use ${list.}
ctx_incident Enable to access the incident context and use ${incident.}

Filter Syntax for expressions, conditions and transformers

primitive-expression ::= <operator> : <value>

dict-expression ::= SET OF primitive-expression

array-expression ::= ARRAY OF ( dict-expression | array-expression | "not" expressions | "or" expressions | "and" expressions )

expressions ::= dict-expression | array-expression

primitive-condition ::= <path> : expressions

condition ::= SET OF primitive-condition

array-condition ::= ARRAY OF condition

conditions ::= condition | array-condition

transformers ::= dict-expression | ARRAY OF dict-expression

dict-expression

and logical operator for each expression.

e.g.

(<value> ends with ".exe") && (<value> starts with "x")

{
  "ends with" : ".exe",
  "starts with": "x"
}

array-expression

Logical operations for each expression. and by default.

e.g.

(<value> ends with ".exe") && (<value> starts with "x")

[
  {"ends with" : ".exe"},
  "and",
  {"starts with": "x"}
]

or

[
  {"ends with" : ".exe"},
  {"starts with": "x"}
]

(<value> ends with ".exe") || (<value> starts with "x")

[
  {"ends with" : ".exe"},
  "or",
  {"starts with": "x"}
]

not (<value> ends with ".exe")

[
  "not",
  {"ends with" : ".exe"}
]

((<value> ends with ".exe") || (<value> ends with ".pdf")) and (<value> starts with "x")

[
  [
    {"ends with" : ".exe"},
    "or",
    {"ends with" : ".pdf"}
  ],
  "and",
  {"starts with": "x"}
]

condition

Evaluates child nodes of each dictionary element.

e.g.

<value>.Domain ends with ".com"

{
  "Domain": {
    "ends with" : ".com"
  }
}

(<value>.Domain ends with ".com") && (<value>.IP starts with "192.168.")

{
  "Domain": {
    "ends with" : ".com"
  },
  "IP": {
    "starts with" : "192.168."
  }
}

array-condition

Logical operations for each condition. and by default.

e.g.

(<value>.Domain ends with ".com") || (<value>.IP starts with "192.168.")

[
  {
    "Domain": {
      "ends with" : ".com"
    }
  }
  "or",
  {
    "IP": {
      "starts with" : "192.168."
    }
  }
]

not ((<value>.Domain ends with ".com") || (<value>.IP starts with "192.168."))

[
  "not",
  [
    {
      "Domain": {
        "ends with" : ".com"
      }
    }
    "or",
    {
      "IP": {
        "starts with" : "192.168."
      }
    }
  ]
]

transformers

Run each transformer in order.

e.g.

base64: encode -> digest

[
  {"base64: encode": {}},
  {"digest": {"algorithm": "sha1"}}
]

base64: encode -> digest (Python 3.7 or above)

{
  "base64: encode": {},
  "digest": {"algorithm": "sha1"}
}

Note:
The order depends on python runtime in a dict-expression. Python 3.6 or less doesn’t guarantee dictionary keys order.


DT (Demisto Transform Language)

In filters written in JSON like expressions, conditions, transformers or <value>, you can set values with DT expressions for keys and values.
When you use DT, you must set ctx_demisto, ctx_inputs, ctx_lists and ctx_incident of the parameters for the data to which DT accesses.

Parameter Data Source Value Description
ctx_demisto From Previous Tasks . Enable to access the context data
ctx_inputs From Previous Tasks inputs Enable to access the input parameters to sub playbooks and use ${inputs.}
ctx_lists From Previous Tasks list Enable to access the list data and use ${list.}
ctx_incident From Previous Tasks incident Enable to access the incident context and use ${incident.}

NOTE: ${list.} doesn’t work in XSOAR 6.0 in transformer.

local prefix (${local.}) and . prefix (${..}) can be available for additional DT references.

${local} refers the root value of the target, and ${local.<name>} refers the value property located at the relateve path to the root.

${..} refers the current value of the target, and ${.<name>} refers the value property located at the relateve path to the current value.

No parameters set is required for using ${local.} and ${..}.

Example 1

{
  "ends with": "${Extension}"
}

Example 2

{
  "${KeyName}": {
    "ends with": "${Extension}"
  }
}

Example 3

{
  "ends with": "${Name}.exe"
}

Example 4

{
  "ends with": "${.=val.Extension}"
}

Example 5

{
  "ends with": "${incident.name}"
}

Example 6

{
  "ends with": "${local.Extension}"
}

Operators

Available operators

  • is transformed with
  • is filtered with
  • value is filtered with
  • keeps
  • doesn't keep
  • is
  • isn't
  • ===
  • !==
  • equals
  • ==
  • doesn't equal
  • !=
  • greater or equal
  • >=
  • greater than
  • >
  • less or equal
  • <=
  • less than
  • in range
  • starts with
  • starts with caseless
  • doesn't start with
  • doesn't start with caseless
  • ends with
  • ends with caseless
  • doesn't end with
  • doesn't end with caseless
  • includes
  • includes caseless
  • doesn't include
  • doesn't include caseless
  • finds
  • finds caseless
  • doesn't find
  • doesn't find caseless
  • matches
  • matches caseless
  • doesn't match
  • doesn't match caseless
  • wildcard: matches
  • wildcard: matches caseless
  • wildcard: doesn't match
  • wildcard: doesn't match caseless
  • regex: matches
  • regex: matches caseless
  • regex: doesn't match
  • regex: doesn't match caseless
  • in
  • in caseless
  • not in
  • not in caseless
  • in list
  • in caseless list
  • not in list
  • not in caseless list
  • contains
  • contains caseless
  • doesn't contain
  • doesn't contain caseless
  • wildcard: contains
  • wildcard: contains caseless
  • wildcard: doesn't contain
  • wildcard: doesn't contain caseless
  • regex: contains
  • regex: contains caseless
  • regex: doesn't contain
  • regex: doesn't contain caseless
  • matches any line of
  • matches any caseless line of
  • doesn't match any line of
  • doesn't match any caseless line of
  • matches any string of
  • matches any caseless string of
  • doesn't match any string of
  • doesn't match any caseless string of
  • wildcard: matches any string of
  • wildcard: matches any caseless string of
  • wildcard: doesn't match any string of
  • wildcard: doesn't match any caseless string of
  • regex: matches any string of
  • regex: matches any caseless string of
  • regex: doesn't match any string of
  • regex: doesn't match any caseless string of
  • contains any line of
  • contains any caseless line of
  • doesn't contain any line of
  • doesn't contain any caseless line of
  • contains any string of
  • contains any caseless line of
  • doesn't contain any string of
  • doesn't contain any caseless line of
  • wildcard: contains any string of
  • wildcard: contains any caseless line of
  • wildcard: doesn't contain any string of
  • wildcard: doesn't contain any caseless line of
  • regex: contains any string of
  • regex: contains any caseless line of
  • regex: doesn't contain any string of
  • regex: doesn't contain any caseless line of
  • matches expressions of
  • matches conditions of
  • value matches expressions of
  • value matches conditions of
  • json: encode array
  • json: encode
  • json: decode
  • base64: encode
  • base64: decode
  • digest
  • is replaced with
  • is updated with
  • appends
  • if-then-else
  • switch-case
  • collects values
  • collects keys
  • flattens with values
  • flattens with keys
  • abort
  • email-header: decode
  • regex: replace
  • is individually transformed with
  • is collectively transformed with

Operator: is transformed with

Transforms elements with `transformers` given in a filter. See `Filter Syntax` for the details of `transformers`.

> **Filter Format**: `transformers` #### Example 1 ##### Input [ { "Name": "a.dat", "Size": 100 }, { "Name": "b.exe", "Size": 200 }, { "Name": "c.txt", "Size": 300 } ] ##### Filter > > **Operator**: is transformed with > **Path**: > **Filter**: { "json: encode": {}, "base64: encode": {} } ##### Output [ "eyJOYW1lIjogImEuZGF0IiwgIlNpemUiOiAxMDB9", "eyJOYW1lIjogImIuZXhlIiwgIlNpemUiOiAyMDB9", "eyJOYW1lIjogImMudHh0IiwgIlNpemUiOiAzMDB9" ] #### Example 2 ##### Input { "File": [ { "Name": "a.dat", "Size": 100 }, { "Name": "b.exe", "Size": 200 } ], "IP": [ "1.1.1.1", "2.2.2.2" ] } ##### Filter > > **Operator**: is transformed with > **Path**: File > **Filter**: { "is filtered with": { "Name": { "ends with": ".exe" } }, "json: encode": {}, "base64: encode": {} } ##### Output { "File": [ "eyJOYW1lIjogImIuZXhlIiwgIlNpemUiOiAyMDB9" ], "IP": [ "1.1.1.1", "2.2.2.2" ] } #### Example 3 ##### Input [ { "Name": "a.dat", "Size": 100 }, { "Name": "b.exe", "Size": 200 } ] ##### Filter > > **Operator**: is transformed with > **Path**: > **Filter**: { "is replaced with": { "User": "JDOE" } } ##### Output [ { "User": "JDOE" } ]


Operator: is filtered with

Evaluates each element of an array with given conditions and returns a set of the elements matched. The value is handled as an array which has only one element when its data type is `dictionary`. See `Filter Syntax` for the details of `conditions`.

> **Filter Format**: `conditions` #### Example 1 ##### Input [ { "Name": "a.dat", "Size": 100 }, { "Name": "b.exe", "Size": 200 }, { "Name": "c.txt", "Size": 300 } ] ##### Filter > > **Operator**: is filtered with > **Path**: > **Filter**: { "Name": { "ends with": ".exe" } } ##### Output [ { "Name": "b.exe", "Size": 200 } ]


Operator: value is filtered with

Evaluates each value of dictionary elements or each element for values whose data type is not `dictionary`, and returns a set of the elements matched to expressions given in a filter. See `Filter Syntax` for the details of `expressions`.

> **Filter Format**: `expressions` #### Example 1 ##### Input [ "192.168.1.1", "1.1.1.1", "192.168.1.2" ] ##### Filter > > **Operator**: value is filtered with > **Path**: > **Filter**: { "starts with": "192.168." } ##### Output [ "192.168.1.1", "192.168.1.2" ] #### Example 2 ##### Input { "Host1": { "User": "JDOE", "IP": "192.168.1.1", "Score": 30 }, "Host2": { "User": "TYAMADA", "IP": "192.168.1.2", "Score": 10 }, "Host3": { "User": "MBLACK", "IP": "3.3.3.3", "Score": 40 } } ##### Filter > > **Operator**: value is filtered with > **Path**: Score > **Filter**: { ">=": 20 } ##### Output { "Host1": { "User": "JDOE", "IP": "192.168.1.1", "Score": 30 }, "Host3": { "User": "MBLACK", "IP": "3.3.3.3", "Score": 40 } }


Operator: keeps

Evaluates each element of an array with keys given and returns a set of the elements which only retains the keys given and corresponding values. The value is handled as an array which has only one element when its data type is `dictionary`.

> **Filter Format**: `expressions` #### Example 1 ##### Input [ { "Host": "JDOE", "IP": "1.1.1.1" }, { "User": "John Doe", "First Name": "John", "Last Name": "Doe" }, { "Host": "YTARO", "User": "Taro Yamada" } ] ##### Filter > > **Operator**: keeps > **Path**: > **Filter**: [ "Host", "User" ] ##### Output [ { "Host": "JDOE" }, { "User": "John Doe" }, { "Host": "YTARO", "User": "Taro Yamada" } ]


Operator: doesn't keeps

Evaluates each element of an array with keys given and returns a set of the elements which are excluded the keys given. The value is handled as an array which has only one element when its data type is `dictionary`.

> **Filter Format**: `expressions` #### Example 1 ##### Input [ { "Host": "JDOE", "IP": "1.1.1.1" }, { "User": "John Doe", "First Name": "John", "Last Name": "Doe" }, { "Host": "YTARO", "User": "Taro Yamada" } ] ##### Filter > > **Operator**: doesn't keeps > **Path**: > **Filter**: [ "Host", "User" ] ##### Output [ { "IP": "1.1.1.1" }, { "First Name": "John", "Last Name": "Doe" }, }, { } ]


Operator: is

This operator works with a sub operator specified as filter.

---- #### Sub Operator: empty

Returns a set of elements which is empty.

#### Example 1 ##### Input 10 ##### Filter > > **Operator**: is > **Path**: > **Filter**: empty ##### Output null #### Example 2 ##### Input [ 10, { }, null, "xxx" ] ##### Filter > > **Operator**: is > **Path**: > **Filter**: empty ##### Output [ { }, null ]

---- #### Sub Operator: null Returns a set of elements which is `null`.

#### Example 1 ##### Input 10 ##### Filter > > **Operator**: is > **Path**: > **Filter**: null ##### Output null #### Example 2 ##### Input [ 10, { }, null, "xxx" ] ##### Filter > > **Operator**: is > **Path**: > **Filter**: null ##### Output [ null ]

---- #### Sub Operator: string Returns a set of elements whose data type is `string`.

#### Example 1 ##### Input 10 ##### Filter > > **Operator**: is > **Path**: > **Filter**: string ##### Output null #### Example 2 ##### Input [ 10, { }, null, "xxx" ] ##### Filter > > **Operator**: is > **Path**: > **Filter**: string ##### Output [ "xxx" ]

---- #### Sub Operator: integer Returns a set of elements whose data type is `integer`.

#### Example 1 ##### Input 10 ##### Filter > > **Operator**: is > **Path**: > **Filter**: integer ##### Output 10 #### Example 2 ##### Input [ 10, "123" ] ##### Filter > > **Operator**: is > **Path**: > **Filter**: integer ##### Output [ 10 ]

---- #### Sub Operator: integer string Returns a set of elements whose data type is `string` and whose value is integer. The value that includes decimal point is evaluated as not integer.

#### Example 1 ##### Input [ 10, "123" ] ##### Filter > > **Operator**: is > **Path**: > **Filter**: integer string ##### Output [ "123" ]

---- #### Sub Operator: any integer Returns a set of elements matched with `string` or `integer string` operator.

#### Example 1 ##### Input [ 10, "123", "xxx" ] ##### Filter > > **Operator**: is > **Path**: > **Filter**: any integer ##### Output [ 10, "123" ]

---- #### Sub Operator: existing key Evaluates each dictionary element of an array, then returns a set of the elements which has a key given in `path`.

#### Example 1 ##### Input [ { "Host": "JDOE", "IP": "1.1.1.1" }, { "User": "John Doe", "Email": "jdoe@domain.com" } ] ##### Filter > > **Operator**: is > **Path**: Host > **Filter**: existing key ##### Output [ { "Host": "JDOE", "IP": "1.1.1.1" } ] #### Example 2 ##### Input [ { "Host": { "IP": "1.1.1.1", "Score": 50, "User": "JDOE" }, "User": { "ID": 1000, "Name": "John Doe" } }, { "Host": { "IP": "2.2.2.2", "Score": 30 } } ] ##### Filter > > **Operator**: is > **Path**: Host.User > **Filter**: existing key ##### Output [ { "Host": { "IP": "1.1.1.1", "Score": 50, "User": "JDOE" }, "User": { "ID": 1000, "Name": "John Doe" } } ]


Operator: isn't

This operator works with a sub operator specified as filter.

---- #### Sub Operator: empty

Returns a set of elements which is not empty.

#### Example 1 ##### Input 10 ##### Filter > > **Operator**: isn't > **Path**: > **Filter**: empty ##### Output 10 #### Example 2 ##### Input [ 10, { }, null, "xxx" ] ##### Filter > > **Operator**: isn't > **Path**: > **Filter**: empty ##### Output [ 10, "xxx" ]

---- #### Sub Operator: null Returns a set of elements which is not `null`.

#### Example 1 ##### Input 10 ##### Filter > > **Operator**: isn't > **Path**: > **Filter**: 10 ##### Output null #### Example 2 ##### Input [ 10, { }, null, "xxx" ] ##### Filter > > **Operator**: isn't > **Path**: > **Filter**: null ##### Output [ 10, { }, "xxx" ]

---- #### Sub Operator: string Returns a set of elements whose data type is not `string`.

#### Example 1 ##### Input 10 ##### Filter > > **Operator**: isn't > **Path**: > **Filter**: string ##### Output 10 #### Example 2 ##### Input [ 10, { }, null, "xxx" ] ##### Filter > > **Operator**: isn't > **Path**: > **Filter**: string ##### Output [ 10, { }, null ]

---- #### Sub Operator: integer Returns a set of elements whose date type is not `integer`.

#### Example 1 ##### Input 10 ##### Filter > > **Operator**: isn't > **Path**: > **Filter**: integer ##### Output null #### Example 2 ##### Input [ 10, "123" ] ##### Filter > > **Operator**: isn't > **Path**: > **Filter**: integer ##### Output [ "123" ]

---- #### Sub Operator: integer string Returns a set of elements whose data type is not `string` or whose value is not integer. The value that includes decimal point is evaluated as not integer.

#### Example 1 ##### Input [ 10, "123", "123.0" ] ##### Filter > > **Operator**: isn't > **Path**: > **Filter**: integer string ##### Output [ 10, "123.0" ]

---- #### Sub Operator: any integer Returns a set of elements which are neither `string` or `integer string`.

#### Example 1 ##### Input [ 10, "123", "xxx" ] ##### Filter > > **Operator**: isn't > **Path**: > **Filter**: any integer ##### Output [ "xxx" ]

---- #### Sub Operator: existing key Evaluates each dictionary element of an array, then returns a set of the elements which doesn't have a key given in `path`.

#### Example 1 ##### Input [ { "Host": "JDOE", "IP": "1.1.1.1" }, { "User": "John Doe", "Email": "jdoe@domain.com" } ] ##### Filter > > **Operator**: isn't > **Path**: Host > **Filter**: existing key ##### Output [ { "User": "John Doe", "Email": "jdoe@domain.com" } ] #### Example 2 ##### Input [ { "Host": { "IP": "1.1.1.1", "Score": 50, "User": "JDOE" }, "User": { "ID": 1000, "Name": "John Doe" } }, { "Host": { "IP": "2.2.2.2", "Score": 30 } } ] ##### Filter > > **Operator**: isn't > **Path**: Host.User > **Filter**: existing key ##### Output [ { "Host": { "IP": "2.2.2.2", "Score": 30 } } ]


Operator: ===

Returns a set of elements which exactly matches to a value given in a filter. It doesn't match when the data types are different.

> **Filter Format**: `` #### Example 1 ##### Input [ 10, "10", 123 ] ##### Filter > > **Operator**: === > **Path**: > **Filter**: 10 ##### Output [ 10 ] #### Example 2 ##### Input [ 10, "10", 123 ] ##### Filter > > **Operator**: === > **Path**: > **Filter**: "10" ##### Output [ "10" ] </details> ---- ### Operator: `!==`

Returns a set of elements which doesn't match the data type or the value of a value given in a filter.

> **Filter Format**: `` #### Example 1 ##### Input [ 10, "10", 123 ] ##### Filter > > **Operator**: !== > **Path**: > **Filter**: 10 ##### Output [ "10", 123 ] </details> ---- ### Operator: `equals`, `==`

Returns a set of elements which is equal to a value given in a filter. The value is implicitly converted from its data type to another in a comparison between different data types. `==` is an alias name for `equals`.

> **Filter Format**: `` #### Example 1 ##### Input [ 10, "10", 123 ] ##### Filter > > **Operator**: equals > **Path**: > **Filter**: 10 ##### Output [ 10, "10" ] </details> ---- ### Operator: `doesn't equal`, `!=`

Returns a set of elements which is not equal to a value given in a filter. The value is implicitly converted from its data type to another in a comparison between different data types. `!=` is an alias name for `doesn't equal`.

> **Filter Format**: `` #### Example 1 ##### Input [ 10, "10", 123 ] ##### Filter > > **Operator**: doesn't equal > **Path**: > **Filter**: 10 ##### Output [ 123 ] </details> ---- ### Operator: `greater or equal`, `>=`

Returns a set of elements which is greater or equal to a value given in a filter. The value is implicitly converted from its data type to number in a comparison. This operator evaluates to false for either or both of the data which cannot convert to number. `>=` is an alias name for `greater or equal`.

> **Filter Format**: `` #### Example 1 ##### Input [ 1, 10, "10", 123 ] ##### Filter > > **Operator**: greater or equal > **Path**: > **Filter**: 10 ##### Output [ 10, "10", 123 ] </details> ---- ### Operator: `greater than`, `>`

Returns a set of elements which is greater than a value given in a filter. The value is implicitly converted from its data type to number in a comparison. This operator evaluates to false for either or both of the data which cannot convert to number. `>` is an alias name for `greater than`.

> **Filter Format**: `` #### Example 1 ##### Input [ 1, 10, "10", 123 ] ##### Filter > > **Operator**: greater than > **Path**: > **Filter**: 10 ##### Output [ 123 ] </details> ---- ### Operator: `less or equal`, `<=`

Returns a set of elements which is less or equal to a value given in a filter. The value is implicitly converted from its data type to number in a comparison. This operator evaluates to false for either or both of the data which cannot convert to number. `<=` is an alias name for `less or equal`.

> **Filter Format**: `` #### Example 1 ##### Input [ 1, 10, "10", 123 ] ##### Filter > > **Operator**: less or equal > **Path**: > **Filter**: 10 ##### Output [ 1, 10, "10" ] </details> ---- ### Operator: `less than`, `<`

Returns a set of elements which is less than a value given in a filter. The value is implicitly converted from its data type to number in a comparison. This operator evaluates to false for either or both of the data which cannot convert to number. `<` is an alias name for `less than`.

> **Filter Format**: `` #### Example 1 ##### Input [ 1, 10, "10", 123 ] ##### Filter > > **Operator**: less than > **Path**: > **Filter**: 10 ##### Output [ 1 ] </details> ---- ### Operator: `in range`

Returns a set of elements which is greater or equal to `min` and less or equal to `max` given in a range. The value is implicitly converted from its data type to number in a comparison. This operator evaluates to false for either or both of the data which cannot convert to number.

> **Filter Format**: `min`,`max` #### Example 1 ##### Input [ 1, 10, "10", "30", 123 ] ##### Filter > > **Operator**: in range > **Path**: > **Filter**: 10,100 ##### Output [ 10, "10", "30" ]

---- ### Operator: `starts with` Returns a set of elements which starts with a string given in a filter.

> **Filter Format**: `string` #### Example 1 ##### Input [ 10, "xxx.exe", "yyy.pdf", { "xxx": "x" } ] ##### Filter > > **Operator**: starts with > **Path**: > **Filter**: xxx ##### Output [ "xxx.exe" ]

---- ### Operator: `starts with caseless` Returns a set of elements which starts with a string given in a filter. It performs case-insensitive matching.

> **Filter Format**: `string` #### Example 1 ##### Input [ 10, "xxx.exe", "XXX.EXE", "yyy.pdf", { "xxx": "x" } ] ##### Filter > > **Operator**: starts with caseless > **Path**: > **Filter**: xxx ##### Output [ "xxx.exe", "XXX.EXE" ]

---- ### Operator: `doesn't start with` Returns a set of elements which doesn't start with a string given in a filter.

> **Filter Format**: `string` #### Example 1 ##### Input [ 10, "xxx.exe", "yyy.pdf", { "xxx": "x" } ] ##### Filter > > **Operator**: doesn't start with > **Path**: > **Filter**: xxx ##### Output [ 10, "yyy.pdf", { "xxx": "x" } ]

---- ### Operator: `doesn't start with caseless` Returns a set of elements which doesn't start with a string given in a filter. It performs case-insensitive matching.

> **Filter Format**: `string` #### Example 1 ##### Input [ 10, "xxx.exe", "XXX.EXE", "yyy.pdf", { "xxx": "x" } ] ##### Filter > > **Operator**: doesn't start with caseless > **Path**: > **Filter**: xxx ##### Output [ 10, "yyy.pdf", { "xxx": "x" } ]

---- ### Operator: `ends with caseless` Returns a set of elements which ends with a string given in a filter. It performs case-insensitive matching.

> **Filter Format**: `string` #### Example 1 ##### Input [ 10, "xxx.exe", "XXX.EXE", "yyy.pdf", { "xxx": "x" } ] ##### Filter > > **Operator**: ends with caseless > **Path**: > **Filter**: .exe ##### Output [ "xxx.exe", "XXX.EXE" ]

---- ### Operator: `doesn't end with` Returns a set of elements which doesn't end with a string given in a filter.

> **Filter Format**: `string` #### Example 1 ##### Input [ 10, "xxx.exe", "yyy.pdf", { "xxx": "x" } ] ##### Filter > > **Operator**: doesn't end with > **Path**: > **Filter**: .exe ##### Output [ 10, "yyy.pdf", { "xxx": "x" } ]

---- ### Operator: `doesn't end with caseless` Returns a set of elements which doesn't end with a string given in a filter. It performs case-insensitive matching.

> **Filter Format**: `string` #### Example 1 ##### Input [ 10, "xxx.exe", "XXX.EXE", "yyy.pdf", { "xxx": "x" } ] ##### Filter > > **Operator**: doesn't end with caseless > **Path**: > **Filter**: .exe ##### Output [ 10, "yyy.pdf", { "xxx": "x" } ]

---- ### Operator: `includes` Returns a set of elements of which a string given in a filter is a substring. The searching only works for `string` data types. It evaluates to unmatched for a element that either or both of the data types is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input www.paloaltonetworks.com ##### Filter > > **Operator**: includes > **Path**: > **Filter**: paloaltonetworks ##### Output www.paloaltonetworks.com #### Example 2 ##### Input [ 10, "www.paloaltonetworks.com", "www.paloaltonetworks.co.jp", { "xxx": "xxx.paloaltonetworks.com" } ] ##### Filter > > **Operator**: includes > **Path**: > **Filter**: paloaltonetworks ##### Output [ "www.paloaltonetworks.com", "www.paloaltonetworks.co.jp" ]

---- ### Operator: `includes caseless` Returns a set of elements of which a string given in a filter is a substring. It performs case-insensitive seaching, and only works for `string` data types. It evaluates to unmatched for a element that either or both of the data types is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input [ 10, "www.paloaltonetworks.com", "WWW.PaloAltoNetworks.COM", { "xxx": "xxx.paloaltonetworks.com" } ] ##### Filter > > **Operator**: includes caseless > **Path**: > **Filter**: paloaltonetworks ##### Output [ "www.paloaltonetworks.com", "WWW.PaloAltoNetworks.COM" ]

---- ### Operator: `doesn't include` Returns a set of elements of which a string given in a filter is not a substring. The searching only works for `string` data types. It evaluates to unmatched for a element that either or both of the data types is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input [ 10, "www.paloaltonetworks.com", "www.paloaltonetworks.co.jp", { "xxx": "xxx.paloaltonetworks.com" } ] ##### Filter > > **Operator**: doesn't include > **Path**: > **Filter**: paloaltonetworks ##### Output [ 10, { "xxx": "xxx.paloaltonetworks.com" } ]

---- ### Operator: `doesn't include caseless` Returns a set of elements of which a string given in a filter is not a substring. It performs case-insensitive seaching, and only works for `string` data types. It evaluates to unmatched for a element that either or both of the data types is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input [ 10, "www.paloaltonetworks.com", "WWW.PaloAltoNetworks.COM", { "xxx": "xxx.paloaltonetworks.com" } ] ##### Filter > > **Operator**: doesn't include caseless > **Path**: > **Filter**: paloaltonetworks ##### Output [ 10, { "xxx": "xxx.paloaltonetworks.com" } ]

---- ### Operator: `finds` Returns the entire target value if a string given in a filter is a substring of any of the elements, `null` otherwise. The searching is performed for a single `string` element or each `string` element of an array.

> **Filter Format**: `string` #### Example 1 ##### Input www.paloaltonetworks.com ##### Filter > > **Operator**: finds > **Path**: > **Filter**: paloaltonetworks ##### Output www.paloaltonetworks.com #### Example 2 ##### Input [ 10, "www.paloaltonetworks.com", "WWW.PaloAltoNetworks.COM", { "xxx": "xxx.paloaltonetworks.com" } ] ##### Filter > > **Operator**: finds > **Path**: > **Filter**: paloaltonetworks ##### Output [ 10, "www.paloaltonetworks.com", "WWW.PaloAltoNetworks.COM", { "xxx": "xxx.paloaltonetworks.com" } ] #### Example 3 ##### Input [ 10, "www.paloaltonetworks.com", "WWW.PaloAltoNetworks.COM", { "xxx": "xxx.paloaltonetworks.com" } ] ##### Filter > > **Operator**: finds > **Path**: > **Filter**: xxx.paloaltonetworks.com ##### Output null

---- ### Operator: `finds caseless` Returns the entire target value if a string given in a filter is a substring of any of the elements, `null` otherwise. The searching is performed for a single `string` element or each `string` element of an array with case-insensitive matching.

> **Filter Format**: `string` #### Example 1 ##### Input WWW.PaloAltoNetworks.COM ##### Filter > > **Operator**: finds caseless > **Path**: > **Filter**: paloaltonetworks ##### Output WWW.PaloAltoNetworks.COM #### Example 2 ##### Input [ 10, "WWW.PaloAltoNetworks.COM", { "xxx": "xxx.paloaltonetworks.com" } ] ##### Filter > > **Operator**: finds caseless > **Path**: > **Filter**: paloaltonetworks ##### Output [ 10, "WWW.PaloAltoNetworks.COM", { "xxx": "xxx.paloaltonetworks.com" } ]

---- ### Operator: `doesn't find` Returns an entire target value if a string given in a filter is not a substring of any of the elements, `null` otherwise. The searching is performed for a single `string` element or each `string` element of an array.

> **Filter Format**: `string` #### Example 1 ##### Input www.paloaltonetworks.com ##### Filter > > **Operator**: doesn't find > **Path**: > **Filter**: paloaltonetworks ##### Output null #### Example 2 ##### Input [ 10, "www.paloaltonetworks.com", "WWW.PaloAltoNetworks.COM", { "xxx": "xxx.paloaltonetworks.com" } ] ##### Filter > > **Operator**: doesn't find > **Path**: > **Filter**: paloaltonetworks ##### Output null #### Example 3 ##### Input [ 10, "www.paloaltonetworks.com", "WWW.PaloAltoNetworks.COM", { "xxx": "xxx.paloaltonetworks.com" } ] ##### Filter > > **Operator**: doesn't find > **Path**: > **Filter**: xxx.paloaltonetworks ##### Output [ 10, "www.paloaltonetworks.com", "WWW.PaloAltoNetworks.COM", { "xxx": "xxx.paloaltonetworks.com" } ]

---- ### Operator: `doesn't find caseless` Returns an entire target value if a string given in a filter is not a substring of any of the elements, `null` otherwise. The searching is performed for a single `string` element or each `string` element of an array with case-insensitive matching.

> **Filter Format**: `string` #### Example 1 ##### Input WWW.PaloAltoNetworks.COM ##### Filter > > **Operator**: doesn't find caseless > **Path**: > **Filter**: PaloAltoNetworks ##### Output null #### Example 2 ##### Input [ 10, "WWW.PaloAltoNetworks.COM", { "xxx": "xxx.paloaltonetworks.com" } ] ##### Filter > > **Operator**: doesn't find caseless > **Path**: > **Filter**: paloaltonetworks ##### Output null #### Example 3 ##### Input [ 10, "WWW.PaloAltoNetworks.COM", { "xxx": "xxx.paloaltonetworks.com" } ] ##### Filter > > **Operator**: doesn't find caseless > **Path**: > **Filter**: xxx.paloaltonetworks ##### Output [ 10, "WWW.PaloAltoNetworks.COM", { "xxx": "xxx.paloaltonetworks.com" } ]

---- ### Operator: `matches` Returns a set of elements which is equal to a string given in a filter. The matching is peformed between `string` data types. It doesn't match for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input www.paloaltonetworks.com ##### Filter > > **Operator**: matches > **Path**: > **Filter**: www.paloaltonetworks.com ##### Output www.paloaltonetworks.com #### Example 2 ##### Input www.paloaltonetworks.com ##### Filter > > **Operator**: matches > **Path**: > **Filter**: paloaltonetworks ##### Output null #### Example 3 ##### Input [ "www.demisto.com", "www.paloaltonetworks.com", { "Host": "www.paloaltonetworks.com" } ] ##### Filter > > **Operator**: matches > **Path**: > **Filter**: www.paloaltonetworks.com ##### Output [ "www.paloaltonetworks.com" ]

---- ### Operator: `matches caseless` Returns a set of elements which matches a string given in a filter. The matching is peformed case-insensitively and between `string` data types. It doesn't match for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input WWW.PaloAltoNetworks.COM ##### Filter > > **Operator**: matches caseless > **Path**: > **Filter**: www.paloaltonetworks.com ##### Output WWW.PaloAltoNetworks.COM #### Example 2 ##### Input WWW.PaloAltoNetworks.COM ##### Filter > > **Operator**: matches caseless > **Path**: > **Filter**: paloaltonetworks ##### Output null #### Example 3 ##### Input [ "www.demisto.com", "WWW.PaloAltoNetworks.COM", { "Host": "www.paloaltonetworks.com" } ] ##### Filter > > **Operator**: matches caseless > **Path**: > **Filter**: www.paloaltonetworks.com ##### Output [ "WWW.PaloAltoNetworks.COM" ]

---- ### Operator: `doesn't match` Returns a set of elements which is not equal to a string given in a filter. The matching is peformed between `string` data types. It doesn't match for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input www.paloaltonetworks.com ##### Filter > > **Operator**: doesn't match > **Path**: > **Filter**: www.paloaltonetworks.com ##### Output null #### Example 2 ##### Input www.paloaltonetworks.com ##### Filter > > **Operator**: doesn't match > **Path**: > **Filter**: paloaltonetworks ##### Output www.paloaltonetworks.com #### Example 3 ##### Input [ "www.demisto.com", "www.paloaltonetworks.com", { "Host": "www.paloaltonetworks.com" } ] ##### Filter > > **Operator**: doesn't match > **Path**: > **Filter**: www.paloaltonetworks.com ##### Output [ "www.demisto.com", { "Host": "www.paloaltonetworks.com" } ]

---- ### Operator: `doesn't match caseless` Returns a set of elements which doesn't match a string given in a filter. The matching is peformed case-insensitively and between `string` data types. It doesn't match for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input WWW.PaloAltoNetworks.COM ##### Filter > > **Operator**: doesn't match caseless > **Path**: > **Filter**: www.paloaltonetworks.com ##### Output null #### Example 2 ##### Input WWW.PaloAltoNetworks.COM ##### Filter > > **Operator**: doesn't match caseless > **Path**: > **Filter**: paloaltonetworks ##### Output WWW.PaloAltoNetworks.COM #### Example 3 ##### Input [ "www.demisto.com", "WWW.PaloAltoNetworks.COM", { "Host": "www.paloaltonetworks.com" } ] ##### Filter > > **Operator**: doesn't match caseless > **Path**: > **Filter**: www.paloaltonetworks.com ##### Output [ "www.demisto.com", { "Host": "www.paloaltonetworks.com" } ]

---- ### Operator: `wildcard: matches` Returns a set of elements which matches a wildcard pattern given in a filter. The matching is peformed between `string` data types. It doesn't match for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input www.paloaltonetworks.com ##### Filter > > **Operator**: wildcard: matches > **Path**: > **Filter**: ???.paloaltonetworks.* ##### Output www.paloaltonetworks.com #### Example 2 ##### Input [ "www.demisto.com", "www.paloaltonetworks.com", { "Host": "www.paloaltonetworks.com" } ] ##### Filter > > **Operator**: wildcard: matches > **Path**: > **Filter**: ???.paloaltonetworks.* ##### Output [ "www.paloaltonetworks.com" ]

---- ### Operator: `wildcard: matches caseless` Returns a set of elements which matches a wildcard pattern given in a filter. The matching is peformed case-insensitively and between `string` data types. It doesn't match for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input WWW.PaloAltoNetworks.COM ##### Filter > > **Operator**: wildcard: matches caseless > **Path**: > **Filter**: ???.paloaltonetworks.* ##### Output WWW.PaloAltoNetworks.COM #### Example 2 ##### Input [ "www.demisto.com", "WWW.PaloAltoNetworks.COM", { "Host": "www.paloaltonetworks.com" } ] ##### Filter > > **Operator**: wildcard: matches caseless > **Path**: > **Filter**: ???.paloaltonetworks.* ##### Output [ "WWW.PaloAltoNetworks.COM" ]

---- ### Operator: `wildcard: doesn't match` Returns a set of elements which doesn't match a wildcard pattern given in a filter. The matching is peformed between `string` data types. It doesn't match for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input www.paloaltonetworks.com ##### Filter > > **Operator**: wildcard: doesn't match > **Path**: > **Filter**: ???.paloaltonetworks.* ##### Output null #### Example 2 ##### Input [ "www.demisto.com", "www.paloaltonetworks.com", { "Host": "www.paloaltonetworks.com" } ] ##### Filter > > **Operator**: wildcard: doesn't match > **Path**: > **Filter**: ???.paloaltonetworks.* ##### Output [ "www.demisto.com", { "Host": "www.paloaltonetworks.com" } ]

---- ### Operator: `wildcard: doesn't match caseless` Returns a set of elements which doesn't match a wildcard pattern given in a filter. The matching is peformed case-insensitively and between `string` data types. It doesn't match for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input WWW.PaloAltoNetworks.COM ##### Filter > > **Operator**: wildcard: doesn't match caseless > **Path**: > **Filter**: ???.paloaltonetworks.* ##### Output null #### Example 2 ##### Input [ "www.demisto.com", "WWW.PaloAltoNetworks.COM", { "Host": "www.paloaltonetworks.com" } ] ##### Filter > > **Operator**: wildcard: doesn't match caseless > **Path**: > **Filter**: ???.paloaltonetworks.* ##### Output [ "www.demisto.com", { "Host": "www.paloaltonetworks.com" } ]

---- ### Operator: `regex: matches` Returns a set of elements which matches a regular expression pattern given in a filter. The matching is peformed between `string` data types. It doesn't match for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input www.paloaltonetworks.com ##### Filter > > **Operator**: regex: matches > **Path**: > **Filter**: .*paloaltonetworks.* ##### Output www.paloaltonetworks.com #### Example 2 ##### Input [ "www.demisto.com", "www.paloaltonetworks.com", { "Host": "www.paloaltonetworks.com" } ] ##### Filter > > **Operator**: regex: matches > **Path**: > **Filter**: .*paloaltonetworks.* ##### Output [ "www.paloaltonetworks.com" ]

---- ### Operator: `regex: matches caseless` Returns a set of elements which matches a regular expression pattern given in a filter. The matching is peformed case-insensitively and between `string` data types. It doesn't match for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input WWW.PaloAltoNetworks.COM ##### Filter > > **Operator**: regex: matches caseless > **Path**: > **Filter**: .*paloaltonetworks.* ##### Output WWW.PaloAltoNetworks.COM #### Example 2 ##### Input [ "www.demisto.com", "WWW.PaloAltoNetworks.COM", { "Host": "www.paloaltonetworks.com" } ] ##### Filter > > **Operator**: regex: matches caseless > **Path**: > **Filter**: .*paloaltonetworks.* ##### Output [ "WWW.PaloAltoNetworks.COM" ]

---- ### Operator: `regex: doesn't match` Returns a set of elements which doesn't match a regular expression pattern given in a filter. The matching is peformed between `string` data types. It doesn't match for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input www.paloaltonetworks.com ##### Filter > > **Operator**: regex: doesn't match > **Path**: > **Filter**: .*paloaltonetworks.* ##### Output null #### Example 2 ##### Input [ "www.demisto.com", "www.paloaltonetworks.com", { "Host": "www.paloaltonetworks.com" } ] ##### Filter > > **Operator**: regex: doesn't match > **Path**: > **Filter**: .*paloaltonetworks.* ##### Output [ "www.demisto.com", { "Host": "www.paloaltonetworks.com" } ]

---- ### Operator: `regex: doesn't match caseless` Returns a set of elements which doesn't match a regular expression pattern given in a filter. The matching is peformed case-insensitively and between `string` data types. It doesn't match for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input WWW.PaloAltoNetworks.COM ##### Filter > > **Operator**: regex: doesn't match caseless > **Path**: > **Filter**: .*paloaltonetworks.* ##### Output null #### Example 2 ##### Input [ "www.demisto.com", "WWW.PaloAltoNetworks.COM", { "Host": "www.paloaltonetworks.com" } ] ##### Filter > > **Operator**: regex: doesn't match caseless > **Path**: > **Filter**: .*paloaltonetworks.* ##### Output [ "www.demisto.com", { "Host": "www.paloaltonetworks.com" } ]

---- ### Operator: `in` Returns a set of a element which matches a element of the values given.

> **Filter Format**: `list` #### Example 1 ##### Input banana ##### Filter > > **Operator**: in > **Path**: > **Filter**: [ "apple", "melon", "banana" ] ##### Output banana #### Example 2 ##### Input [ "apple", "orange", "banana" ] ##### Filter > > **Operator**: in > **Path**: > **Filter**: [ "apple", "melon", "banana" ] ##### Output [ "apple", "banana" ]

---- ### Operator: `in caseless` Returns a set of a element which matches a element of the values given. The matching is peformed case-insensitively for `string` elements.

> **Filter Format**: `list` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: in caseless > **Path**: > **Filter**: [ "apple", "melon", "banana" ] ##### Output Banana #### Example 2 ##### Input [ "Apple", "Orange", "Banana" ] ##### Filter > > **Operator**: in caseless > **Path**: > **Filter**: [ "apple", "melon", "banana" ] ##### Output [ "Apple", "Banana" ]

---- ### Operator: `not in` Returns a set of a element which doesn't match any element of the values given.

> **Filter Format**: `list` #### Example 1 ##### Input banana ##### Filter > > **Operator**: not in > **Path**: > **Filter**: [ "apple", "melon", "banana" ] ##### Output null #### Example 2 ##### Input [ "apple", "orange", "banana" ] ##### Filter > > **Operator**: not in > **Path**: > **Filter**: [ "apple", "melon", "banana" ] ##### Output orange

---- ### Operator: `not in caseless` Returns a set of a element which doesn't match any element of the values given. The matching is peformed case-insensitively for `string` elements.

> **Filter Format**: `list` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: not in caseless > **Path**: > **Filter**: [ "apple", "melon", "banana" ] ##### Output null #### Example 2 ##### Input [ "Apple", "Orange", "Banana" ] ##### Filter > > **Operator**: not in caseless > **Path**: > **Filter**: [ "apple", "melon", "banana" ] ##### Output Orange

---- ### Operator: `in list` Returns a set of elements which matches any of strings of a comma separated list. The matching always evaluates to false for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input banana ##### Filter > > **Operator**: in list > **Path**: > **Filter**: apple,banana,cherry ##### Output banana #### Example 2 ##### Input [ "apple", "melon", "banana", { "fruit": "orange" } ] ##### Filter > > **Operator**: in list > **Path**: > **Filter**: apple,banana,cherry ##### Output [ "apple", "banana" ]

---- ### Operator: `in caseless list` Returns a set of elements which matches any of strings of a comma separated list. The matching is peformed case-insensitively, and always evaluates to false for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: in caseless list > **Path**: > **Filter**: apple,banana,cherry ##### Output Banana #### Example 2 ##### Input [ "Apple", "Melon", "Banana", { "Fruit": "Orange" } ] ##### Filter > > **Operator**: in caseless list > **Path**: > **Filter**: apple,banana,cherry ##### Output [ "Apple", "Banana" ]

---- ### Operator: `not in list` Returns a set of elements which doesn't match any of strings of a comma separated list. The matching always evaluates to false for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input melon ##### Filter > > **Operator**: not in list > **Path**: > **Filter**: apple,banana,cherry ##### Output melon #### Example 2 ##### Input banana ##### Filter > > **Operator**: not in list > **Path**: > **Filter**: apple,banana,cherry ##### Output null #### Example 3 ##### Input [ "apple", "melon", "banana", { "fruit": "orange" } ] ##### Filter > > **Operator**: not in list > **Path**: > **Filter**: apple,banana,cherry ##### Output [ "melon", { "fruit": "orange" } ]

---- ### Operator: `not in caseless list` Returns a set of elements which doesn't match any of strings of a comma separated list. The matching is peformed case-insensitively, and always evaluates to false for a element whose data type is not `string`.

> **Filter Format**: `string` #### Example 1 ##### Input Melon ##### Filter > > **Operator**: not in caseless list > **Path**: > **Filter**: apple,banana,cherry ##### Output Melon #### Example 2 ##### Input Banana ##### Filter > > **Operator**: not in caseless list > **Path**: > **Filter**: apple,banana,cherry ##### Output null #### Example 3 ##### Input [ "Apple", "Melon", "Banana", { "Fruit": "Orange" } ] ##### Filter > > **Operator**: not in caseless list > **Path**: > **Filter**: apple,banana,cherry ##### Output [ "Melon", { "Fruit": "Orange" } ]

---- ### Operator: `contains` Returns an entire value if any of the elements matches a string given in a filter, `null` otherwise.

> **Filter Format**: `string` #### Example 1 ##### Input apple ##### Filter > > **Operator**: contains > **Path**: > **Filter**: apple ##### Output apple #### Example 2 ##### Input banana ##### Filter > > **Operator**: contains > **Path**: > **Filter**: apple ##### Output null #### Example 3 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: contains > **Path**: > **Filter**: apple ##### Output [ "apple", "banana", "cherry" ]

---- ### Operator: `contains caseless` Returns an entire value if any of the elements matches a string given in a filter, `null` otherwise. The matching is peformed case-insensitively.

> **Filter Format**: `string` #### Example 1 ##### Input Apple ##### Filter > > **Operator**: contains caseless > **Path**: > **Filter**: apple ##### Output Apple #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: contains caseless > **Path**: > **Filter**: apple ##### Output [ "Apple", "Banana", "Cherry" ]

---- ### Operator: `doesn't contain` Returns an entire value if all of the elements doesn't match a string given in a filter, `null` otherwise.

> **Filter Format**: `string` #### Example 1 ##### Input apple ##### Filter > > **Operator**: doesn't contain > **Path**: > **Filter**: apple ##### Output null #### Example 2 ##### Input banana ##### Filter > > **Operator**: doesn't contain > **Path**: > **Filter**: apple ##### Output banana #### Example 3 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: doesn't contain > **Path**: > **Filter**: apple ##### Output null

---- ### Operator: `doesn't contain caseless` Returns an entire value if all of the elements doesn't match a string given in a filter, `null` otherwise. The matching is peformed case-insensitively.

> **Filter Format**: `string` #### Example 1 ##### Input Apple ##### Filter > > **Operator**: doesn't contain caseless > **Path**: > **Filter**: apple ##### Output null #### Example 2 ##### Input banana ##### Filter > > **Operator**: doesn't contain caseless > **Path**: > **Filter**: apple ##### Output banana #### Example 3 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: doesn't contain caseless > **Path**: > **Filter**: apple ##### Output null

---- ### Operator: `wildcard: contains` Returns an entire value if any of the elements matches a wildcard pattern given in a filter, `null` otherwise.

> **Filter Format**: `string` #### Example 1 ##### Input apple ##### Filter > > **Operator**: wildcard: contains > **Path**: > **Filter**: *a* ##### Output apple #### Example 2 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: wildcard: contains > **Path**: > **Filter**: *a* ##### Output [ "apple", "banana", "cherry" ]

---- ### Operator: `wildcard: contains caseless` Returns an entire value if any of the elements matches a wildcard pattern given in a filter, `null` otherwise. The matching is peformed case-insensitively.

> **Filter Format**: `string` #### Example 1 ##### Input Apple ##### Filter > > **Operator**: wildcard: contains caseless > **Path**: > **Filter**: *a* ##### Output Apple #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: wildcard: contains caseless > **Path**: > **Filter**: *a* ##### Output [ "Apple", "Banana", "Cherry" ]

---- ### Operator: `wildcard: doesn't contain` Returns an entire value if all of the elements doesn't match a wildcard pattern given in a filter, `null` otherwise.

> **Filter Format**: `string` #### Example 1 ##### Input apple ##### Filter > > **Operator**: wildcard: doesn't contain > **Path**: > **Filter**: *a* ##### Output null #### Example 2 ##### Input cherry ##### Filter > > **Operator**: wildcard: doesn't contain > **Path**: > **Filter**: *a* ##### Output cherry #### Example 3 ##### Input [ "cherry", "melon" ] ##### Filter > > **Operator**: wildcard: doesn't contain > **Path**: > **Filter**: *a* ##### Output [ "cherry", "melon" ]

---- ### Operator: `wildcard: doesn't contain caseless` Returns an entire value if all of the elements doesn't match a wildcard pattern given in a filter, `null` otherwise. The matching is peformed case-insensitively.

> **Filter Format**: `string` #### Example 1 ##### Input Apple ##### Filter > > **Operator**: wildcard: doesn't contain caseless > **Path**: > **Filter**: *a* ##### Output null #### Example 2 ##### Input cherry ##### Filter > > **Operator**: wildcard: doesn't contain caseless > **Path**: > **Filter**: *a* ##### Output cherry #### Example 3 ##### Input [ "Cherry", "Melon" ] ##### Filter > > **Operator**: wildcard: doesn't contain caseless > **Path**: > **Filter**: *a* ##### Output [ "Cherry", "Melon" ]

---- ### Operator: `regex: contains` Returns an entire value if any of the elements matches a regular expression given in a filter, `null` otherwise.

> **Filter Format**: `string` #### Example 1 ##### Input apple ##### Filter > > **Operator**: regex: contains > **Path**: > **Filter**: .*a.* ##### Output apple #### Example 2 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: regex: contains > **Path**: > **Filter**: .*a.* ##### Output [ "apple", "banana", "cherry" ]

---- ### Operator: `regex: contains caseless` Returns an entire value if any of the elements matches a regular expression given in a filter, `null` otherwise. The matching is peformed case-insensitively.

> **Filter Format**: `string` #### Example 1 ##### Input Apple ##### Filter > > **Operator**: regex: contains caseless > **Path**: > **Filter**: .*a.* ##### Output Apple #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: regex: contains caseless > **Path**: > **Filter**: .*a.* ##### Output [ "Apple", "Banana", "Cherry" ]

---- ### Operator: `regex: doesn't contain` Returns an entire value if all of the elements doesn't match a regular expression given in a filter, `null` otherwise.

> **Filter Format**: `string` #### Example 1 ##### Input apple ##### Filter > > **Operator**: regex: doesn't contain > **Path**: > **Filter**: .*a.* ##### Output null #### Example 2 ##### Input cherry ##### Filter > > **Operator**: regex: doesn't contain > **Path**: > **Filter**: .*a.* ##### Output cherry #### Example 3 ##### Input [ "cherry", "melon" ] ##### Filter > > **Operator**: regex: doesn't contain > **Path**: > **Filter**: .*a.* ##### Output [ "cherry", "melon" ]

---- ### Operator: `regex: doesn't contain caseless` Returns an entire value if all of the elements doesn't match a regular expression given in a filter, `null` otherwise. The matching is peformed case-insensitively.

> **Filter Format**: `string` #### Example 1 ##### Input Apple ##### Filter > > **Operator**: regex: doesn't contain caseless > **Path**: > **Filter**: .*a.* ##### Output null #### Example 2 ##### Input cherry ##### Filter > > **Operator**: regex: doesn't contain caseless > **Path**: > **Filter**: .*a.* ##### Output cherry #### Example 3 ##### Input [ "Cherry", "Melon" ] ##### Filter > > **Operator**: regex: doesn't contain caseless > **Path**: > **Filter**: .*a.* ##### Output [ "Cherry", "Melon" ]

---- ### Operator: `matches any line of` Returns a set of elements which matches any line of a text given in a filter.

> **Filter Format**: `string` #### Example 1 ##### Input banana ##### Filter > > **Operator**: matches any line of > **Path**: > **Filter**: apple banana cherry ##### Output banana #### Example 2 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: matches any line of > **Path**: > **Filter**: orange banana apple ##### Output [ "apple", "banana" ] #### Example 3 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: matches any line of > **Path**: > **Filter**: melon lemon orange ##### Output [ ]

---- ### Operator: `matches any caseless line of` Returns a set of elements which matches any line of a text given in a filter. The matching is peformed case-insensitively.

> **Filter Format**: `string` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: matches any caseless line of > **Path**: > **Filter**: apple banana cherry ##### Output Banana #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: matches any caseless line of > **Path**: > **Filter**: orange banana apple ##### Output [ "Apple", "Banana" ]

---- ### Operator: `doesn't match any line of` Returns a set of elements which doesn't match any line of a text given in a filter.

> **Filter Format**: `string` #### Example 1 ##### Input banana ##### Filter > > **Operator**: doesn't match any line of > **Path**: > **Filter**: apple banana cherry ##### Output null #### Example 2 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: doesn't match any line of > **Path**: > **Filter**: melon orange banana ##### Output [ "apple", "cherry" ]

---- ### Operator: `doesn't match any caseless line of` Returns a set of elements which doesn't match any line of a text given in a filter. The matching is peformed case-insensitively.

> **Filter Format**: `string` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: doesn't match any caseless line of > **Path**: > **Filter**: apple banana cherry ##### Output null #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: doesn't match any caseless line of > **Path**: > **Filter**: melon lemon orange ##### Output [ "Apple", "Banana", "Cherry" ] #### Example 3 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: doesn't match any caseless line of > **Path**: > **Filter**: melon orange banana ##### Output [ "Apple", "Cherry" ]

---- ### Operator: `matches any string of` Returns a set of elements which matches any strings given in a filter.

> **Filter Format**: ` or ` #### Example 1 ##### Input banana ##### Filter > > **Operator**: matches any string of > **Path**: > **Filter**: "banana" ##### Output banana #### Example 2 ##### Input banana ##### Filter > > **Operator**: matches any string of > **Path**: > **Filter**: [ "apple", "banana", "cherry" ] ##### Output banana #### Example 3 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: matches any string of > **Path**: > **Filter**: [ "orange", "banana", "apple" ] ##### Output [ "apple", "banana" ] #### Example 4 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: matches any string of > **Path**: > **Filter**: [ "melon", "lemon", "orange" ] ##### Output [ ] </details> ---- ### Operator: `matches any caseless string of`

Returns a set of elements which matches any strings given in a filter. The matching is peformed case-insensitively.

> **Filter Format**: ` or ` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: matches any caseless string of > **Path**: > **Filter**: [ "apple", "banana", "cherry" ] ##### Output Banana #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: matches any caseless string of > **Path**: > **Filter**: [ "orange", "banana", "apple" ] ##### Output [ "Apple", "Banana" ] </details> ---- ### Operator: `doesn't match any string of`

Returns a set of elements which doesn't match any strings given in a filter.

> **Filter Format**: ` or ` #### Example 1 ##### Input banana ##### Filter > > **Operator**: doesn't match any string of > **Path**: > **Filter**: [ "apple", "banana", "cherry" ] ##### Output null #### Example 2 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: doesn't match any string of > **Path**: > **Filter**: [ "melon", "orange", "banana" ] ##### Output [ "apple", "cherry" ] </details> ---- ### Operator: `doesn't match any caseless string of`

Returns a set of elements which doesn't match any strings given in a filter. The matching is peformed case-insensitively.

> **Filter Format**: ` or ` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: doesn't match any caseless string of > **Path**: > **Filter**: [ "apple", "banana", "cherry" ] ##### Output null #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: doesn't match any caseless string of > **Path**: > **Filter**: [ "melon", "orange", "banana" ] ##### Output [ "Apple", "Cherry" ] </details> ---- ### Operator: `wildcard: matches any string of`

Returns a set of elements which matches any wildcard patterns given in a filter.

> **Filter Format**: ` or ` #### Example 1 ##### Input banana ##### Filter > > **Operator**: wildcard: matches any string of > **Path**: > **Filter**: "b?????" ##### Output banana #### Example 2 ##### Input banana ##### Filter > > **Operator**: wildcard: matches any string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output banana #### Example 3 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: wildcard: matches any string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output [ "banana", "cherry" ] #### Example 4 ##### Input [ "melon", "lemon", "orange" ] ##### Filter > > **Operator**: wildcard: matches any string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output [ ] </details> ---- ### Operator: `wildcard: matches any caseless string of`

Returns a set of elements which matches any wildcard patterns given in a filter. The matching is peformed case-insensitively.

> **Filter Format**: ` or ` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: wildcard: matches any caseless string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output Banana #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: wildcard: matches any caseless string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output [ "Banana", "Cherry" ] </details> ---- ### Operator: `wildcard: doesn't match any string of`

Returns a set of elements which doesn't match any wildcard patterns given in a filter.

> **Filter Format**: ` or ` #### Example 1 ##### Input banana ##### Filter > > **Operator**: wildcard: doesn't match any string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output null #### Example 2 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: wildcard: doesn't match any string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output [ "apple" ] </details> ---- ### Operator: `wildcard: doesn't match any caseless string of`

Returns a set of elements which doesn't match any wildcard patterns given in a filter. The matching is peformed case-insensitively.

> **Filter Format**: ` or ` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: wildcard: doesn't match any caseless string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output null #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: wildcard: doesn't match any caseless string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output [ "Apple" ] </details> ---- ### Operator: `regex: matches any string of`

Returns a set of elements which matches any regular expression patterns given in a filter.

> **Filter Format**: ` or ` #### Example 1 ##### Input banana ##### Filter > > **Operator**: regex: matches any string of > **Path**: > **Filter**: "b....." ##### Output banana #### Example 2 ##### Input banana ##### Filter > > **Operator**: regex: matches any string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output banana #### Example 3 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: regex: matches any string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output [ "banana", "cherry" ] #### Example 4 ##### Input [ "melon", "lemon", "orange" ] ##### Filter > > **Operator**: regex: matches any string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output [ ] </details> ---- ### Operator: `regex: matches any caseless string of`

Returns a set of elements which matches any regular expression patterns given in a filter. The matching is peformed case-insensitively.

> **Filter Format**: ` or ` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: regex: matches any caseless string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output Banana #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: regex: matches any caseless string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output [ "Banana", "Cherry" ] </details> ---- ### Operator: `regex: doesn't match any string of`

Returns a set of elements which doesn't match any regular expression patterns given in a filter.

> **Filter Format**: ` or ` #### Example 1 ##### Input banana ##### Filter > > **Operator**: regex: doesn't match any string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output null #### Example 2 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: regex: doesn't match any string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output [ "apple" ] </details> ---- ### Operator: `regex: doesn't match any caseless string of`

Returns a set of elements which doesn't match any regular expression patterns given in a filter. The matching is peformed case-insensitively.

> **Filter Format**: ` or ` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: regex: doesn't match any caseless string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output null #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: regex: doesn't match any caseless string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output [ "Apple" ] </details> ---- ### Operator: `contains any line of`

Returns an entire value if any of the elements matches any line of a text given in a filter, `null` otherwise.

> **Filter Format**: `string` #### Example 1 ##### Input banana ##### Filter > > **Operator**: contains any line of > **Path**: > **Filter**: apple banana cherry ##### Output banana #### Example 2 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: contains any line of > **Path**: > **Filter**: melon orange banana ##### Output [ "apple", "banana", "cherry" ] #### Example 3 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: contains any line of > **Path**: > **Filter**: melon lemon orange ##### Output null

---- ### Operator: `contains any caseless line of` Returns an entire value if any of the elements matches any line of a text given in a filter, `null` otherwise. The matching is peformed case-insensitively.

> **Filter Format**: `string` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: contains any caseless line of > **Path**: > **Filter**: apple banana cherry ##### Output Banana #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: contains any caseless line of > **Path**: > **Filter**: melon orange banana ##### Output [ "Apple", "Banana", "Cherry" ]

---- ### Operator: `doesn't contain any line of` Returns an entire value if all of the elements doesn't match any line of a text given in a filter, `null` otherwise.

> **Filter Format**: `string` #### Example 1 ##### Input banana ##### Filter > > **Operator**: doesn't contain any line of > **Path**: > **Filter**: apple banana cherry ##### Output null #### Example 2 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: doesn't contain any line of > **Path**: > **Filter**: melon lemon orange ##### Output [ "apple", "banana", "cherry" ] #### Example 3 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: doesn't contain any line of > **Path**: > **Filter**: melon orange banana ##### Output null

---- ### Operator: `doesn't contain any caseless line of` Returns an entire value if all of the elements doesn't match any line of a text given in a filter, `null` otherwise. The matching is peformed case-insensitively.

> **Filter Format**: `string` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: doesn't contain any caseless line of > **Path**: > **Filter**: apple banana cherry ##### Output null #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: doesn't contain any caseless line of > **Path**: > **Filter**: melon lemon orange ##### Output [ "Apple", "Banana", "Cherry" ] #### Example 3 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: doesn't contain any caseless line of > **Path**: > **Filter**: melon orange banana ##### Output null

---- ### Operator: `contains any string of` Returns an entire value if any of the elements matches any strings given in a filter, `null` otherwise.

> **Filter Format**: ` or ` #### Example 1 ##### Input banana ##### Filter > > **Operator**: contains any string of > **Path**: > **Filter**: "banana" ##### Output banana #### Example 2 ##### Input banana ##### Filter > > **Operator**: contains any string of > **Path**: > **Filter**: [ "apple", "banana", "cherry" ] ##### Output banana #### Example 3 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: contains any string of > **Path**: > **Filter**: [ "melon", "orange", "banana" ] ##### Output [ "apple", "banana", "cherry" ] #### Example 4 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: contains any string of > **Path**: > **Filter**: [ "melon", "lemon", "orange" ] ##### Output null </details> ---- ### Operator: `contains any caseless line of`

Returns an entire value if any of the elements matches any strings given in a filter, `null` otherwise. The matching is peformed case-insensitively.

> **Filter Format**: ` or ` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: contains any caseless line of > **Path**: > **Filter**: [ "apple", "banana", "cherry" ] ##### Output Banana #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: contains any caseless line of > **Path**: > **Filter**: [ "melon", "orange", "banana" ] ##### Output [ "Apple", "Banana", "Cherry" ] </details> ---- ### Operator: `doesn't contain any string of`

Returns an entire value if all of the elements doesn't match any strings given in a filter, `null` otherwise.

> **Filter Format**: ` or ` #### Example 1 ##### Input banana ##### Filter > > **Operator**: doesn't contain any string of > **Path**: > **Filter**: [ "apple", "banana", "cherry" ] ##### Output null #### Example 2 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: doesn't contain any string of > **Path**: > **Filter**: [ "melon", "lemon", "orange" ] ##### Output [ "apple", "banana", "cherry" ] #### Example 3 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: doesn't contain any string of > **Path**: > **Filter**: [ "melon", "orange", "banana" ] ##### Output null </details> ---- ### Operator: `doesn't contain any caseless line of`

Returns an entire value if all of the elements doesn't match any strings given in a filter, `null` otherwise. The matching is peformed case-insensitively.

> **Filter Format**: ` or ` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: doesn't contain any caseless line of > **Path**: > **Filter**: [ "apple", "banana", "cherry" ] ##### Output null #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: doesn't contain any caseless line of > **Path**: > **Filter**: [ "melon", "lemon", "orange" ] ##### Output [ "Apple", "Banana", "Cherry" ] #### Example 3 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: doesn't contain any caseless line of > **Path**: > **Filter**: [ "melon", "orange", "banana" ] ##### Output null </details> ---- ### Operator: `wildcard: contains any string of`

Returns an entire value if any of the elements matches any wildcard patterns given in a filter, `null` otherwise.

> **Filter Format**: ` or ` #### Example 1 ##### Input banana ##### Filter > > **Operator**: wildcard: contains any string of > **Path**: > **Filter**: "b?????" ##### Output banana #### Example 2 ##### Input banana ##### Filter > > **Operator**: wildcard: contains any string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output banana #### Example 3 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: wildcard: contains any string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output [ "apple", "banana", "cherry" ] #### Example 4 ##### Input [ "melon", "lemon", "orange" ] ##### Filter > > **Operator**: wildcard: contains any string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output null </details> ---- ### Operator: `wildcard: contains any caseless string of`

Returns an entire value if any of the elements matches any wildcard patterns given in a filter, `null` otherwise. The matching is peformed case-insensitively.

> **Filter Format**: ` or ` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: wildcard: contains any caseless string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output Banana #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: wildcard: contains any caseless string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output [ "Apple", "Banana", "Cherry" ] </details> ---- ### Operator: `wildcard: doesn't contain any string of`

Returns an entire value if all of the elements doesn't match any wildcard patterns given in a filter, `null` otherwise.

> **Filter Format**: ` or ` #### Example 1 ##### Input banana ##### Filter > > **Operator**: wildcard: doesn't contain any string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output null #### Example 2 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: wildcard: doesn't contain any string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output null #### Example 3 ##### Input [ "melon", "lemon", "orange" ] ##### Filter > > **Operator**: wildcard: doesn't contain any string of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output [ "melon", "lemon", "orange" ] </details> ---- ### Operator: `wildcard: doesn't contain any caseless line of`

Returns an entire value if all of the elements doesn't match any wildcard patterns given in a filter, `null` otherwise. The matching is peformed case-insensitively.

> **Filter Format**: ` or ` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: wildcard: doesn't contain any caseless line of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output null #### Example 2 ##### Input [ "Melon", "Lemon", "Orange" ] ##### Filter > > **Operator**: wildcard: doesn't contain any caseless line of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output [ "Melon", "Lemon", "Orange" ] #### Example 3 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: wildcard: doesn't contain any caseless line of > **Path**: > **Filter**: [ "b?????", "*c*", "*d*" ] ##### Output null </details> ---- ### Operator: `regex: contains any string of`

Returns an entire value if any of the elements matches any regular expression patterns given in a filter, `null` otherwise.

> **Filter Format**: ` or ` #### Example 1 ##### Input banana ##### Filter > > **Operator**: regex: contains any string of > **Path**: > **Filter**: "b....." ##### Output banana #### Example 2 ##### Input banana ##### Filter > > **Operator**: regex: contains any string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output banana #### Example 3 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: regex: contains any string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output [ "apple", "banana", "cherry" ] #### Example 4 ##### Input [ "melon", "lemon", "orange" ] ##### Filter > > **Operator**: regex: contains any string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output null </details> ---- ### Operator: `regex: contains any caseless string of`

Returns an entire value if any of the elements matches any regex patterns given in a filter, `null` otherwise. The matching is peformed case-insensitively.

> **Filter Format**: ` or ` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: regex: contains any caseless string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output Banana #### Example 2 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: regex: contains any caseless string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output [ "Apple", "Banana", "Cherry" ] </details> ---- ### Operator: `regex: doesn't contain any string of`

Returns an entire value if all of the elements doesn't match any regex patterns given in a filter, `null` otherwise.

> **Filter Format**: ` or ` #### Example 1 ##### Input banana ##### Filter > > **Operator**: regex: doesn't contain any string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output null #### Example 2 ##### Input [ "apple", "banana", "cherry" ] ##### Filter > > **Operator**: regex: doesn't contain any string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output null #### Example 3 ##### Input [ "melon", "lemon", "orange" ] ##### Filter > > **Operator**: regex: doesn't contain any string of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output [ "melon", "lemon", "orange" ] </details> ---- ### Operator: `regex: doesn't contain any caseless line of`

Returns an entire value if all of the elements doesn't match any regex patterns given in a filter, `null` otherwise. The matching is peformed case-insensitively.

> **Filter Format**: ` or ` #### Example 1 ##### Input Banana ##### Filter > > **Operator**: regex: doesn't contain any caseless line of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output null #### Example 2 ##### Input [ "Melon", "Lemon", "Orange" ] ##### Filter > > **Operator**: regex: doesn't contain any caseless line of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output [ "Melon", "Lemon", "Orange" ] #### Example 3 ##### Input [ "Apple", "Banana", "Cherry" ] ##### Filter > > **Operator**: regex: doesn't contain any caseless line of > **Path**: > **Filter**: [ "b.....", ".*c.*", ".*d.*" ] ##### Output null </details> ---- ### Operator: `matches expressions of`

Returns the result of a value filtered by `expressions` given. See `Filter Syntax` for the details of `expressions`.

> **Filter Format**: `expressions` #### Example 1 ##### Input [ "aaa.dat", "bbb.exe", "ccc.exe" ] ##### Filter > > **Operator**: matches expressions of > **Path**: > **Filter**: { "ends with": ".exe", "starts with": "c" } ##### Output [ "ccc.exe" ] #### Example 2 ##### Input { "Domain": [ "www.paloaltonetworks.com", "www.paloaltonetworks.co.jp", "www.demisto.com" ], "IP": [ "1.1.1.1", "2.2.2.2", "3.3.3.3" ] } ##### Filter > > **Operator**: matches expressions of > **Path**: Domain > **Filter**: [ {"ends with": ".co.jp"}, "or", {"includes": "demisto"} ] ##### Output { "Domain": [ "www.paloaltonetworks.co.jp", "www.demisto.com" ], "IP": [ "1.1.1.1", "2.2.2.2", "3.3.3.3" ] }

---- ### Operator: `matches conditions of` Returns the result of a value filtered by `conditions` given. See `Filter Syntax` for the details of `conditions`.

> **Filter Format**: `conditions` #### Example 1 ##### Input { "TrustedDevices": [ "D000002", "D000003" ], "Events": [ { "Description": "User Logged In - Success", "DeviceID": "D000001" }, { "Description": "File uploaded", "DeviceID": "D000001" }, { "Description": "File downloaded", "DeviceID": "D000002" }, { "Description": "User Logged In - Failed", "DeviceID": "D000003" } ] } ##### Filter > > **Operator**: matches conditions of > **Path**: Events > **Filter**: [ { "Description": { "==": "User Logged In - Failed" } }, "or", [ { "Description": { "in list": "File uploaded,File downloaded" } }, "and", "not", { "DeviceID": { "matches any string of": "${local.TrustedDevices}" } } ] ] ##### Output { "Events": [ { "Description": "File uploaded", "DeviceID": "D000001" }, { "Description": "User Logged In - Failed", "DeviceID": "D000003" } ], "TrustedDevices": [ "D000002", "D000003" ] } #### Example 2 ##### Input { "Result": { "File": [ { "Name": "a.dat", "Size": 100 }, { "Name": "b.exe", "Size": 200 }, { "Name": "c.txt", "Size": 300 } ], "Host": [ { "Name": "computer1", "IP": "1.1.1.1" }, { "Name": "server1", "IP": "2.2.2.2" } ] } } ##### Filter > > **Operator**: matches conditions of > **Path**: > **Filter**: { "Result.File": { "is filtered with" : { "Name": { "ends with": ".exe" } } }, "Result.Host": { "is filtered with" : { "Name": { "starts with": "server" } } } } ##### Output { "Result": { "File": [ { "Name": "b.exe", "Size": 200 } ], "Host": [ { "Name": "server1", "IP": "2.2.2.2" } ] } } #### Example 3 ##### Input { "Result": { "File": [ { "Name": "a.dat", "Size": 100 }, { "Name": "b.exe", "Size": 200 }, { "Name": "c.txt", "Size": 300 } ], "Host": [ { "Name": "computer1", "IP": "1.1.1.1" }, { "Name": "server1", "IP": "2.2.2.2" } ] } } ##### Filter > > **Operator**: matches conditions of > **Path**: > **Filter**: { "Result": { "is filtered with" : { "File": { "is filtered with": { "Name": { "ends with": ".exe" } } }, "Host": { "is filtered with": { "Name": { "starts with": "server" } } } } } } ##### Output { "Result": { "File": [ { "Name": "b.exe", "Size": 200 } ], "Host": [ { "Name": "server1", "IP": "2.2.2.2" } ] } } #### Example 4 ##### Input { "Result" : { "Domain" : [ "www.paloaltonetworks.com", "www.demisto.com", "paloaltonetowrks.com" ], "IP" : [ "1.1.1.1", "2.2.2.2", "3.3.3.3" ] } } ##### Filter > > **Operator**: matches conditions of > **Path**: > **Filter**: { "Result.Domain": { "is filtered with": { "": { "starts with": "www." } } } } ##### Output { "Result" : { "Domain" : [ "www.paloaltonetworks.com", "www.demisto.com" ], "IP" : [ "1.1.1.1", "2.2.2.2", "3.3.3.3" ] } }

---- ### Operator: `value matches expressions of` Evaluates each value of dictionary elements or each element for values whose data type is not `dictionary`, and returns a set of the elements matched to expressions given in a filter. See `Filter Syntax` for the details of `expressions`.

> **Filter Format**: `expressions` #### Example 1 ##### Input [ "1.1.1.1", "2.2.2.2", "3.3.3.3" ] ##### Filter > > **Operator**: value matches expressions of > **Path**: > **Filter**: { "contains": "1.1.1.1" } ##### Output [ "1.1.1.1" ] #### Example 2 ##### Input { "Communication": { "Host1": [ "1.1.1.1", "2.2.2.2" ], "Host2": "1.1.1.1", "Host3": [ "3.3.3.3", "4.4.4.4" ] } } ##### Filter > > **Operator**: value matches expressions of > **Path**: Communication > **Filter**: { "contains": "1.1.1.1" } ##### Output { "Communication": { "Host1": [ "1.1.1.1", "2.2.2.2" ], "Host2": "1.1.1.1" } }

---- ### Operator: `value matches conditions of` Evaluates each value of dictionary elements, and returns a set of the elements matched to conditions given in a filter. See `Filter Syntax` for the details of `conditions`.

> **Filter Format**: `conditions` #### Example 1 ##### Input { "Host1": { "User": "JDOE", "IP": "192.168.1.1", "Score": 30 }, "Host2": { "User": "TYAMADA", "IP": "192.168.1.2", "Score": 10 }, "Host3": { "User": "MBLACK", "IP": "3.3.3.3", "Score": 40 } } ##### Filter > > **Operator**: value matches conditions of > **Path**: > **Filter**: { "Score": { ">=": 20 } } ##### Output { "Host1": { "User": "JDOE", "IP": "192.168.1.1", "Score": 30 }, "Host3": { "User": "MBLACK", "IP": "3.3.3.3", "Score": 40 } } #### Example 2 ##### Input { "Host1": { "User": "JDOE", "IP": "192.168.1.1", "Score": 30, "File": { "Risk": [ "xxx.exe", "yyy.pdf" ] } }, "Host2": { "User": "TYAMADA", "IP": "192.168.1.2", "Score": 10 }, "Host3": { "User": "MBLACK", "IP": "3.3.3.3", "Score": 40, "File": { "Risk": [ "aaa.pdf", "bbb.exe" ] } } } ##### Filter > > **Operator**: value matches conditions of > **Path**: > **Filter**: { "Score": { ">=": 20 }, "File.Risk": { "is filtered with": { "": { "ends with": ".exe" } } } } ##### Output { "Host1": { "User": "JDOE", "IP": "192.168.1.1", "Score": 30, "File": { "Risk": [ "xxx.exe" ] } }, "Host3": { "User": "MBLACK", "IP": "3.3.3.3", "Score": 40, "File": { "Risk": [ "bbb.exe" ] } } }

---- ### Operator: `json: encode array` Returns an string in JSON which is encoded the entire value.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | | indent | int | The number of spaces per indent (Default: None) | #### Example 1 ##### Input [ 10, 20 ] ##### Filter > > **Operator**: json: encode array > **Path**: > **Filter**: { } ##### Output "[10,20]" #### Example 2 ##### Input [ 10, 20 ] ##### Filter > > **Operator**: json: encode array > **Path**: > **Filter**: { "indent": 4 } ##### Output [ "1.1.1.1", "2.2.2.2" ]

---- ### Operator: `json: encode` Encodes each element and returns a set of JSON-encoded string.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | | indent | int | The number of spaces per indent (Default: None) | #### Example 1 ##### Input [ { "xxx": 10 }, 20 ] ##### Filter > > **Operator**: json: encode > **Path**: > **Filter**: { } ##### Output [ {"xxx":10}, 20 ] #### Example 2 ##### Input [ { "xxx": 10 }, 20 ] ##### Filter > > **Operator**: json: encode > **Path**: > **Filter**: { "indent": 4 } ##### Output [ { "xxx": 10 }, 20 ]

---- ### Operator: `json: decode` Returns a set of JSON decoded-values from the each element.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | (parameter is currently not required) #### Example 1 ##### Input [ {"xxx":10}, {"yyy":20} ] ##### Filter > > **Operator**: json: decode > **Path**: > **Filter**: { } ##### Output [ { "xxx": 10 }, { "yyy": 20 } ]

---- ### Operator: `base64: encode` Encodes each element and returns a set of BASE64-encoded string.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | (parameter is currently not required) #### Example 1 ##### Input [ "xxx", "yyy" ] ##### Filter > > **Operator**: base64: encode > **Path**: > **Filter**: { } ##### Output [ "eHh4", "eXl5" ]

---- ### Operator: `base64: decode` Returns a set of BASE64 decoded-values from the each element.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | (parameter is currently not required) #### Example 1 ##### Input [ "eHh4", "eXl5" ] ##### Filter > > **Operator**: base64: decode > **Path**: > **Filter**: { } ##### Output [ "xxx", "yyy" ]

---- ### Operator: `digest` Create a set of secure hash value for each element.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | | algorithm | string | Secure hash algorithm (Default: sha256). See python hashlib for algorithm names. | #### Example 1 ##### Input [ "xxx", "yyy" ] ##### Filter > > **Operator**: digest > **Path**: > **Filter**: { } ##### Output [ "cd2eb0837c9b4c962c22d2ff8b5441b7b45805887f051d39bf133b583baf6860", "f2afd1cacb5441a5e65a7a460a5f9898b7b98b08aa6323a2e53c8b9a9686cd86" ] #### Example 2 ##### Input [ "xxx", "yyy" ] ##### Filter > > **Operator**: digest > **Path**: > **Filter**: { "algorithm": "sha256" } ##### Output [ "cd2eb0837c9b4c962c22d2ff8b5441b7b45805887f051d39bf133b583baf6860", "f2afd1cacb5441a5e65a7a460a5f9898b7b98b08aa6323a2e53c8b9a9686cd86" ]

---- ### Operator: `is replaced with` Replaces an entire value with a value given in a filter.

> **Filter Format**: `` #### Example 1 ##### Input [ "apple", "banana" ] ##### Filter > > **Operator**: is replaced with > **Path**: > **Filter**: [ { "fruit" : "${local}" } ] ##### Output [ { "fruit" : [ "apple", "banana" ] } ] #### Example 2 ##### Input { "fruit": "apple" } ##### Filter > > **Operator**: is replaced with > **Path**: > **Filter**: { "fruit": "banana", "vegitable": "tomato" } ##### Output { "fruit": "banana", "vegitable": "tomato" } </details> ---- ### Operator: `is updated with`

If both of the data types are `dicrionary`, all the elements given in a filter are added to the value. All the values are replaced with the value given the existing key. Otherwise, it is simply replaced with a value given in a filter.

> **Filter Format**: `` #### Example 1 ##### Input [ "apple", "banana" ] ##### Filter > > **Operator**: is updated with > **Path**: > **Filter**: [ { "fruit" : "${local}" } ] ##### Output [ { "fruit" : [ "apple", "banana" ] } ] #### Example 2 ##### Input { "fruit": "apple" } ##### Filter > > **Operator**: is updated with > **Path**: > **Filter**: { "vegitable": "tomato" } ##### Output { "fruit": "banana", "vegitable": "tomato" } </details> ---- ### Operator: `appends`

Appends all the elements given in a filter to the value.

> **Filter Format**: `` #### Example 1 ##### Input [ "apple", "banana" ] ##### Filter > > **Operator**: appends > **Path**: > **Filter**: [ "cherry", "lemon" ] ##### Output [ "apple", "banana", "cherry", "lemon" ] #### Example 2 ##### Input { "File": [ "a.exe", "b.pdf" ] } ##### Filter > > **Operator**: appends > **Path**: > **Filter**: { "IP": [ "1.1.1.1", "2.2.2.2" ] } ##### Output [ { "File": [ "a.exe", "b.pdf" ] }, { "IP": [ "1.1.1.1", "2.2.2.2" ] } ] </details> ---- ### Operator: `if-then-else`

Evaluates each element with `if` condition, and returns a set of the results of `then` or `else` operations. If `if` condition is not given or returns any value, `then` operation is executed, otherwise `else` operation is executed.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | | if | expressions | (Optional) `if` condition | | then | expressions | Conditions to execute if `if` condition is not given or returns any value. | | else | expressions | (Optional) Conditions to execute if `if` returns `null`. | | lhs | expressions | (Optional) The value used for the `if` condition instead of the current element. | #### Example 1 ##### Input [ { "Name": "a.dat", "Size": 100 }, { "Name": "b.exe", "Size": 200 }, { "Name": "c.txt", "Size": 300 } ] ##### Filter > > **Operator**: if-then-else > **Path**: > **Filter**: { "if": { "is filtered with": { "Name": { "ends with": ".exe" } } }, "then": { "is updated with": { "Executable": true } }, "else": { "is updated with": { "Executable": false } } } ##### Output [ { "Name": "a.dat", "Size": 100, "Executable": false }, { "Name": "b.exe", "Size": 200, "Executable": true }, { "Name": "c.txt", "Size": 300, "Executable": false } ] #### Example 2 ##### Input [ "a.dat", "b.exe", "c.txt" ] ##### Filter > > **Operator**: if-then-else > **Path**: > **Filter**: { "if": { "ends with": ".exe" }, "then": { "is replaced with": 10 } } ##### Output [ "a.dat", 10, "c.txt" ] #### Example 3 ##### Input [ "a.dat", "b.exe", "c.txt" ] ##### Filter > > **Operator**: if-then-else > **Path**: > **Filter**: { "then": { "is replaced with": 10 } } ##### Output [ 10, 10, 10 ] #### Example 4 ##### Input [ "a.dat", "b.exe", "c.txt" ] ##### Filter > > **Operator**: if-then-else > **Path**: > **ctx_demisto**: (in dictionaly, not string) { "enable_filter": true } > **Filter**: { "if": { "===": true }, "then": { "ends with": ".exe" }, "lhs": "${enable_filter}" } ##### Output [ "b.exe" ]

---- ### Operator: `switch-case` Performs expressions for the label whose `expressions` matches the value. If any of `expressions` doesn't match the value, `default` operation is executed.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | | switch | dict[<label>, expressions] | (Optional) Patterns of conditions. | | default | expressions | (Optional) Conditions to execute if it doesn't match all the `switch` conditions. | | <label>| expressions | (Optional) Conditions to execute if it matches the conditions given in the label. | #### Example 1 ##### Input [ { "IP": "1.1.1.1", "Score": 80 }, { "IP": "2.2.2.2", "Score": 50 }, { "IP": "3.3.3.3", "Score": 20 } ] ##### Filter > > **Operator**: switch-case > **Path**: > **Filter**: { "switch": { "#low": { "is filtered with": { "Score": { "<=": 30 } } }, "#high": { "is filtered with": { "Score": { ">=": 70 } } } }, "#low": { "is updated with": { "Risk": "low" } }, "#high": { "is updated with": { "Risk": "high" } }, "default": { "is updated with": { "Risk": "middle" } } } ##### Output [ { "IP": "1.1.1.1", "Score": 80, "Risk": "high" }, { "IP": "2.2.2.2", "Score": 50, "Risk": "middle" }, { "IP": "3.3.3.3", "Score": 20, "Risk": "low" } ] #### Example 2 ##### Input [ { "IP": "1.1.1.1", "Score": 80 }, { "IP": "2.2.2.2", "Score": 50 }, { "IP": "3.3.3.3", "Score": 20 } ] ##### Filter > > **Operator**: switch-case > **Path**: > **Filter**: { "switch": { "#low": { "is filtered with": { "Score": { "<=": 30 } } }, "#high": { "is filtered with": { "Score": { ">=": 70 } } } }, "#low": { "is updated with": { "Risk": "low" } }, "#high": { "is updated with": { "Risk": "high" } } } ##### Output [ { "IP": "1.1.1.1", "Score": 80, "Risk": "high" }, { "IP": "2.2.2.2", "Score": 50 }, { "IP": "3.3.3.3", "Score": 20, "Risk": "low" } ]

---- ### Operator: `collects values` Returns a set of <value> of each element. A value is <value> for `dict`, otherwise element itself.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | (parameter is currently not required) #### Example 1 ##### Input { "JDOE": { "IP": [ "1.1.1.1", "1.1.1.2" ], "Score": 30 }, "TYAMADA": { "IP": "2.2.2.2", "Score": 10 }, "MBLACK": { "IP": "3.3.3.3", "Score": 40 } } ##### Filter > > **Operator**: collects values > **Path**: > **Filter**: {} ##### Output [ { "IP": [ "1.1.1.1", "1.1.1.2" ], "Score": 30 }, { "IP": "2.2.2.2", "Score": 10 }, { "IP": "3.3.3.3", "Score": 40 } ] #### Example 2 ##### Input [ "1.1.1.1", "2.2.2.2", "3.3.3.3" ] ##### Filter > > **Operator**: collects values > **Path**: > **Filter**: {} ##### Output [ "1.1.1.1", "2.2.2.2", "3.3.3.3" ]

---- ### Operator: `collects keys` Returns a set of <key> of each `dict` element.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | (parameter is currently not required) #### Example 1 ##### Input { "JDOE": { "IP": [ "1.1.1.1", "1.1.1.2" ], "Score": 30 }, "TYAMADA": { "IP": "2.2.2.2", "Score": 10 }, "MBLACK": { "IP": "3.3.3.3", "Score": 40 } } ##### Filter > > **Operator**: collects keys > **Path**: > **Filter**: {} ##### Output [ "JDOE", "TYAMADA", "MBLACK" ]

---- ### Operator: `flattens with values` Returns a set of <value> of all the elements in the tree.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | (parameter is currently not required) #### Example 1 ##### Input { "JDOE": { "IP": [ "1.1.1.1", "1.1.1.2" ], "Score": 30 }, "TYAMADA": { "IP": "2.2.2.2", "Score": 10 }, "MBLACK": { "IP": "3.3.3.3", "Score": 40 } } ##### Filter > > **Operator**: flattens with values > **Path**: > **Filter**: {} ##### Output [ "1.1.1.1", "1.1.1.2", 30, "2.2.2.2", 10, "3.3.3.3", 40 ]

---- ### Operator: `flattens with keys` Returns a set of <key> of all the `dict` elements in the tree.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | (parameter is currently not required) #### Example 1 ##### Input { "JDOE": { "IP": [ "1.1.1.1", "1.1.1.2" ], "Score": 30 }, "TYAMADA": { "IP": "2.2.2.2", "Score": 10 }, "MBLACK": { "IP": "3.3.3.3", "Score": 40 } } ##### Filter > > **Operator**: flattens with keys > **Path**: > **Filter**: {} ##### Output [ "JDOE", "IP", "Score", "TYAMADA", "IP", "Score", "MBLACK", "IP", "Score" ]

---- ### Operator: `abort` Raises an exception and exit with the value filtered at the operator. This operator is available for troubleshooting and debugging.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | (parameter is currently not required) #### Example 1 ##### Filter > > **Operator**: abort > **Path**: > **Filter**: { }

---- ### Operator: `email-header: decode` Returns an string which is decoded with the email header encoding manner.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | (parameter is currently not required) #### Example 1 ##### Input =?ISO-2022-JP?B?GyRCJCIkJCQmJCgkKhsoQg==?= ##### Filter > > **Operator**: email-header: decode > **Path**: > **Filter**: { } ##### Output あいうえお #### Example 2 ##### Input ABC =?ISO-2022-JP?B?GyRCJCIkJCQmJCgkKhsoQg==?= XYZ ##### Filter > > **Operator**: email-header: decode > **Path**: > **Filter**: { } ##### Output ABC あいうえお XYZ

---- ### Operator: `regex: replace` Evaluates the pattern matching, and returns the data given in "matched" or "unmatched" according to the result. Returns the data given in "matched" if matched, "unmatch" otherwise.

> **Filter Format**: `dict[str,Any]` | *Parameter* | *Data Type* | *Description* | | --- | --- | --- | | pattern | str | A pattern text in regex. | | matched | Any | The data to return when matched. capture groups such as \1 are supported. | | unmatched | Any | (Optional) The data to return when unmatched. If not specified, the value given will return. | | caseless | bool | (Optional) true if the matching performs in case-insensitive, false means case-sensitive. The default value is false. | | dotall | bool | (Optional) . (single dot) matches any of charactors excluding new line charactors by default. true if it matches any of the charactors including them. The default value is false. See re.DOTALL | | multiline | bool | (Optional) true if the matching performs in multi-line mode, false otherwise. The default value is false. See re.MULTILINE | #### Example 1 ##### Input Re: Re: Fw: Hello! ##### Filter > > **Operator**: regex: replace > **Path**: > **Filter**: { "pattern": "( *(Re: *|Fw: *)*)(.*)", "matched": "\\3" } ##### Output Hello! #### Example 2 ##### Input XYZ ##### Filter > > **Operator**: regex: replace > **Path**: > **Filter**: { "pattern": ".*(abc).*", "matched": "\\1", "unmatched": "unmatched" } ##### Output unmatched #### Example 3 ##### Input XYZ ##### Filter > > **Operator**: regex: replace > **Path**: > **Filter**: { "pattern": ".*(abc).*", "matched": "\\1" } ##### Output XYZ

---- ### Operator: `is individually transformed with` Transform each element with `transformers` given in a filter. See `Filter Syntax` for the details of `transformers`.

> **Filter Format**: `transformers` #### Example 1 ##### Input [ { "Name": "a.dat", "Size": 100 }, { "Name": "b.exe", "Size": 200 }, { "Name": "c.txt", "Size": 300 } ] ##### Filter > > **Operator**: is individually transformed with > **Path**: > **Filter**: { "json: encode": {}, "base64: encode": {} } ##### Output [ "eyJOYW1lIjogImEuZGF0IiwgIlNpemUiOiAxMDB9", "eyJOYW1lIjogImIuZXhlIiwgIlNpemUiOiAyMDB9", "eyJOYW1lIjogImMudHh0IiwgIlNpemUiOiAzMDB9" ] #### Example 2 ##### Input { "File": [ { "Name": "a.dat", "Size": 100 }, { "Name": "b.exe", "Size": 200 } ], "IP": [ "1.1.1.1", "2.2.2.2" ] } ##### Filter > > **Operator**: is individually transformed with > **Path**: File > **Filter**: { "is filtered with": { "Name": { "ends with": ".exe" } }, "json: encode": {}, "base64: encode": {} } ##### Output { "File": [ "eyJOYW1lIjogImIuZXhlIiwgIlNpemUiOiAyMDB9" ], "IP": [ "1.1.1.1", "2.2.2.2" ] } #### Example 3 ##### Input [ { "Name": "a.dat", "Size": 100 }, { "Name": "b.exe", "Size": 200 } ] ##### Filter > > **Operator**: is individually transformed with > **Path**: > **Filter**: { "is replaced with": { "User": "JDOE" } } ##### Output [ { "User": "JDOE" }, { "User": "JDOE" } ] #### Example 4 ##### Input [ { "Name": "a.dat", "Size": 100 }, { "Name": "b.exe", "Size": 200 } ] ##### Filter > > **Operator**: is individually transformed with > **Path**: > **Filter**: { "is updated with": { "Size": "${..Size=val+1}" } } ##### Output [ { "Name": "a.dat", "Size": 101 }, { "Name": "b.exe", "Size": 201 } ]

---- ### Operator: `is collectively transformed with` Transform elements with `transformers` given in a filter. The elements are handled and transformed as one value at the first level if the type of it is array. See `Filter Syntax` for the details of `transformers`.

> **Filter Format**: `transformers` #### Example 1 ##### Input [ { "Name": "a.dat", "Trusted": true }, { "Name": "b.exe", "Trusted": false }, { "Name": "c.txt", "Trusted": true } ] ##### Filter > > **Operator**: is collectively transformed with > **Path**: > **Filter**: { "switch-case": { "switch": { "#has_untrusted": { "is filtered with": { "Trusted": { "===": false } } } }, "#has_untrusted": { "is replaced with": [ "Untrusted" ] }, "default": { "is replaced with": [ "Trusted" ] } } } ##### Output [ "Untrusted" ]