def get_text_handler(regexp, postfix):
    """Get function to add postfix for every regexp matched substring."""

    def handler(data):
        if not data.strip():
            return data
        return regexp.sub(lambda m: m.group(0) + postfix, data)

    return handler