import re


def is_semantic_string(semantic_string):
    """
    Check if input string is a semantic version as defined here: https://github.com/semver/semver/blob/master/semver.md,
    The version is allowed a lower case 'v' character.
    Function will search a match according to the regular expresion, so for example '1.1.2-prerelease+meta' is valid,
    then make sure there is and exact singe match and validate if each of x,y,z is an integer.
    return {'prefix': boolean, 'version': [x, y, z], 'release': 'some-release', 'metadata': 'some-metadata'} if True

    :param semantic_string: string
    :return: dict if True, else False
    """
    if type(semantic_string) != str or len(semantic_string) == 0:
        return False

    version_prefix = False
    # In case the version if of type 'v2.2.5' then save 'v' prefix and cut it for further 'semver' validation
    if semantic_string[0] == 'v':
        semantic_string = semantic_string[1:]
        version_prefix = True

    semver_regex = re.compile(r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)"  # Match x.y.z
                              # Match -sometext-12.here
                              r"(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)"
                              r"(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?"
                              # Match +more.123.here
                              r"(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$")
    # returns a list of tuples, for example [('2', '2', '7', 'alpha', '')]
    match = semver_regex.findall(semantic_string)

    # There was no match using 'semver_regex', since if 0 or more then single match found and empty list returned
    if len(match) == 0:
        return False

    try:
        semantic_array = [int(n) for n in match[0][:3]]
    except ValueError:
        return False

    return {'prefix': version_prefix, 'version': semantic_array, 'release': match[0][3], 'metadata': match[0][4]}