import re


def degsextodec(string):
    """
    Convert [-]dd:mm:ss.sss to decimal degrees
    """
    match_dec = re.match(r"(-*)(\d+):(\d+):(\d+\.\d+)", string)
    if match_dec:
        sign = match_dec.group(1)
        if sign == '-':
            sign = -1.0
        else:
            sign = +1.0

        degs = float(match_dec.group(2))
        minutes = float(match_dec.group(3))
        secs = float(match_dec.group(4))

        minutes += (secs/60.0)
        degs += (minutes/60.0)

        degs *= sign
    else:
        raise ValueError('Invalid Dec string')

    return degs