def _strip_metachars(val):
    """
    When a filter uses a / or - in the search, only the elements
    name and comment field is searched. This can cause issues if
    searching a network element, i.e. 1.1.1.0/24 where the /24 portion
    is not present in the name and only the elements ipv4_network
    attribute. If exact_match is not specified, strip off the /24
    portion. Queries of this nature should instead use a kw filter
    of: ipv4_network='1.1.1.0/24'.
    """
    ignore_metachar = r'(.+)([/-].+)'
    match = re.search(ignore_metachar, str(val))
    if match:
        left_half = match.group(1)
        return left_half
    return val
When a filter uses a / or - in the search, only the elements
    name and comment field is searched. This can cause issues if
    searching a network element, i.e. 1.1.1.0/24 where the /24 portion
    is not present in the name and only the elements ipv4_network
    attribute. If exact_match is not specified, strip off the /24
    portion. Queries of this nature should instead use a kw filter
    of: ipv4_network='1.1.1.0/24'.