import re


def re_fn(pat, item):
    """Customized search function.

    :param str pat: pattern
    :param str item: target
    :return: if item matches pattern
    :rtype: bool
    """
    try:
        reg = re.compile(pat, re.I)  # perform case-insensitive matching
        return reg.search(item) is not None
    except re.error:
        return False