import re


def new_exposures(out):
    """Scan rsync output for exposures to be transferred.

    Parameters
    ----------
    out : :class:`str`
        Output from :command:`rsync`.

    Returns
    -------
    :class:`set`
        The unique exposure numbers detected in `out`.
    """
    e = set()
    e_re = re.compile(r'([0-9]{8})/?')
    for l in out.split('\n'):
        m = e_re.match(l)
        if m is not None:
            e.add(m.groups()[0])
    return e