def _attrregexfilter(label, pattern, expr):
    """
    Build an `attrregexfilter(<label>, <pattern>, <expr>)` type query
    expression.

    `pattern` is a regular expression for matching against the provided
    `label`.

    `expr` is a query expression of any supported type.
    """
    return 'attrregexfilter({label}, "{pattern}", {expr})'.format(
        label = label,
        pattern = pattern,
        expr = expr,
    )