import re


def sub(iterable, pattern, repl=None):
    """Replaces a substring with another substring using regular expressions.

    :param iterable: collection of data to transform
    :type iterable: list

    :param pattern: regular expression to match and be replaced
    :type pattern: string

    :param repl: (optional) the replacement substring
    :type rep: string
    """

    repl = repl or ""
    return (re.sub(pattern, repl, x) for x in iterable)