import re


def range_string_to_list(range_string):
    """Convert a range string into a list containing all values in the
    values represented by the range string.

    Parameters:
        range_string    The range string to convert into a list

    Return:
        A list of all the values contained in the range string.

    Examples:
        "1"         -> [1]
        "1..3"      -> [1,2,3]
    """
    re_valid_range_string = re.compile(r"^(\d+)(\.\.(\d+))?$")
    matches = re_valid_range_string.match(range_string.strip())

    if matches is None:
        errmsg = "Malformed range string {} - must be of the form " + \
                    "x[..y] and can be comma separated"
        raise ValueError(errmsg.format(range_string))

    start, _, end = matches.groups()
    if end is None:
        end = start

    # The ending value of the range_string's range is inclusive unlike
    # Python's range. Add 1 to end to adjust for this.
    return list(range(int(start), int(end) + 1))