Validates a uuid
@param  {String} version
345200
function uuid(version) {
    var v = (version) ? version : '';

    // verify its a valid string
    this.assert(
      (typeof this._obj === 'string' || this._obj instanceof String),
      'expected #{this} to be of type #{exp} but got #{act}',
      'expected #{this} to not be of type #{exp}',
      'string',
      typeof(this._obj)
    );

    // assert it is a valid uuid
    var regex = getRegEx(v);
    this.assert(
      regex.test(this._obj),
      'expected #{this} to be a valid UUID ' + v,
      'expected #{this} to not be a UUID ' + v
    );    
  }
285264
def validate(ctx, sandbox):
    
    m = RepoManager(ctx.obj['agile'])
    if not sandbox or m.can_release('sandbox'):
        click.echo(m.validate_version())
190931
function(apiVersion) {
    if (!apiVersion) {
      return undefined;
    }
    var parts = apiVersion.split("/");
    if (parts.length === 1) {
      if (parts[0] === "v1") {
        return {group: '', version: parts[0]};
      }
      return {group: parts[0], version: ''};
    }
    if (parts.length === 2) {
      return {group:parts[0], version: parts[1]};
    }
    Logger.warn('Invalid apiVersion "' + apiVersion + '"');
    return undefined;
  }
495436
def _validate_version(request)
      unless self.class.versions.include?(request.version)
        _error!(Errors::NotFoundError, request.version)
      end
    end
780401
function validatePackageInformation( $package, $http, $currentStepID, &$stepMap, &$persistentData, &$errorList )
    {
        $packageName = false;
        $packageSummary = false;
        $packageVersion = false;
        $packageDescription = false;
        $packageLicence = 'GPL';
        $packageHost = false;
        $packagePackager = false;
        if ( $http->hasPostVariable( 'PackageName' ) )
        {
            $packageName = trim( $http->postVariable( 'PackageName' ) );
        }
        if ( $http->hasPostVariable( 'PackageSummary' ) )
            $packageSummary = $http->postVariable( 'PackageSummary' );
        if ( $http->hasPostVariable( 'PackageDescription' ) )
            $packageDescription = $http->postVariable( 'PackageDescription' );
        if ( $http->hasPostVariable( 'PackageVersion' ) )
            $packageVersion = trim( $http->postVariable( 'PackageVersion' ) );
        if ( $http->hasPostVariable( 'PackageLicence' ) )
            $packageLicence = $http->postVariable( 'PackageLicence' );
        if ( $http->hasPostVariable( 'PackageHost' ) )
            $packageHost = $http->postVariable( 'PackageHost' );
        if ( $http->hasPostVariable( 'PackagePackager' ) )
            $packagePackager = $http->postVariable( 'PackagePackager' );

        $persistentData['name'] = $packageName;
        $persistentData['summary'] = $packageSummary;
        $persistentData['description'] = $packageDescription;
        $persistentData['version'] = $packageVersion;
        $persistentData['licence'] = $packageLicence;
        $persistentData['host'] = $packageHost;
        $persistentData['packager'] = $packagePackager;

        $result = true;
        if ( $packageName == '' )
        {
            $errorList[] = array( 'field' => ezpI18n::tr( 'kernel/package', 'Package name' ),
                                  'description' => ezpI18n::tr( 'kernel/package', 'Package name is missing' ) );
            $result = false;
        }
        else
        {
            $existingPackage = eZPackage::fetch( $packageName, false, true );
            if ( $existingPackage )
            {
                $errorList[] = array( 'field' => ezpI18n::tr( 'kernel/package', 'Package name' ),
                                      'description' => ezpI18n::tr( 'kernel/package', 'A package named %packagename already exists, please give another name', false, array( '%packagename' => $packageName ) ) );
                $result = false;
            }
            else
            {
                // Make sure the package name contains only valid characters
                $trans = eZCharTransform::instance();
                $validPackageName = $trans->transformByGroup( $packageName, 'identifier' );
                if ( strcmp( $validPackageName, $packageName ) != 0 )
                {
                    $errorList[] = array( 'field' => ezpI18n::tr( 'kernel/package', 'Package name' ),
                                          'description' => ezpI18n::tr( 'kernel/package', "The package name %packagename is not valid, it can only contain characters in the range a-z, 0-9 and underscore.", false, array( '%packagename' => $packageName ) ) );
                    $result = false;
                }
            }
        }
        if ( !$packageSummary )
        {
            $errorList[] = array( 'field' => ezpI18n::tr( 'kernel/package', 'Summary' ),
                                  'description' => ezpI18n::tr( 'kernel/package', 'Summary is missing' ) );
            $result = false;
        }
        if ( !preg_match( "#^[0-9](\.[0-9]([a-zA-Z]+[0-9]*)?)*$#", $packageVersion ) )
        {
            $errorList[] = array( 'field' => ezpI18n::tr( 'kernel/package', 'Version' ),
                                  'description' => ezpI18n::tr( 'kernel/package', 'The version must only contain numbers (optionally followed by text) and must be delimited by dots (.), e.g. 1.0, 3.4.0beta1' ) );
            $result = false;
        }
        return $result;
    }
1151214
function dataPreprocess (version) {
        var util = require('./util');

        if (util.isNumber(version)) {
            version = version.toString();
        }
        if (util.isArray(version)) {
            version = version.join('.');
        }

        if (util.isCorrectVersion(version)) {
            return util.toArray(version);
        }

        return 'Wrong Params.';
    }
870911
function (version) {
        //var pattern = VERSION_PATTERN;
        var match = version.match(VERSION_PATTERN);
        if (match) {
            return [
                parseInt(match[1]),
                parseInt(match[2] || "0"),
                parseInt(match[3] || "0"),
                versionStageToInt(match[4]),
                parseInt(match[5] || "0"),
            ];
        }
        return null;
    }
93264
public static function uuid($version = self::UUID_V4){

        switch($version){
            case self::UUID_V4:
                $data = openssl_random_pseudo_bytes(16);

                $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0010
                $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10

                return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));

            default:
                throw new Exception("Invalid or unknown uuid version specified");
        }
    }
1095129
public void validate(@Nullable String version) {
    if (reportDownloadTimeout != null) {
      Preconditions.checkArgument(
          reportDownloadTimeout >= 0, "Report download timeout is < 0: %s", reportDownloadTimeout);
    }
  }
1371495
function tag_version(){
	return new Promise((resolve, reject)=>{
		const pkg = reload('../../package.json');
    const tag = `v${pkg.version}`;
    gutil.log('Tagging as: '+gutil.colors.cyan(tag));
    git.tag(tag, `Tagging as ${tag}`, (err)=>{
			checkError(err);
			resolve(tag);
    })
	})
}
424394
def version_is_valid(version_str):
    
    try:
        packaging.version.Version(version_str)
    except packaging.version.InvalidVersion:
        return False
    return True
773964
public static function isValidProtocolVersion($version)
    {
        if (!is_string($version) || empty($version)) {
            return false;
        }

        return (bool) preg_match('#^(1\.[01]|2)$#', $version);
    }
249337
function default_versionCode(version) {
    var nums = version.split('-')[0].split('.');
    var versionCode = 0;
    if (+nums[0]) {
        versionCode += +nums[0] * 10000;
    }
    if (+nums[1]) {
        versionCode += +nums[1] * 100;
    }
    if (+nums[2]) {
        versionCode += +nums[2];
    }
    return versionCode;
}
931614
function validateUpdates (updates, meta) {
  var language = meta.language
  var i, j, update

  if (!updates || !updates.length)
    throw new BadRequestError(
      message('UpdateRecordsInvalid', language))

  for (i = 0, j = updates.length; i < j; i++) {
    update = updates[i]
    if (!update[primaryKey])
      throw new BadRequestError(
        message('UpdateRecordMissingID', language))
  }
}
703944
def isValidSemver(version):
    """"""
    if version and isinstance(version, string_types):
        try:
            semver.parse(version)
        except (TypeError,ValueError):
            return False
        else:
            return True
    return False
721715
private function validateSemanticVersion($theVersion)
  {
    /**
     * Notice:
     * Version validation http://semver.org/
     * Example:
     * Valid version numbers: 1, 1.2, 2.2.3, 1.2.6-alpha, 4.2.3-alpha.beta, 1.5.0-rc.1;
     * Invalid version numbers: 1., 1.2., 1beta, 4.5alpha, 1.2.3-rc_1;
     */
    $status = preg_match('/^(\d+)(?:\.(\d+))?(?:\.((\d+)(?:-([A-Za-z]+)(?:\.(\w+))?)?))?$/', $theVersion, $matches);

    $version = [];

    if ($status)
    {
      $version['version'] = $matches[0];
      $version['major']   = $matches[1];
      $version['minor']   = $matches[2];

      // The above regexp will put the pre-release part in the patch part. Separate patch and pre-release part using
      // ordinary string manipulation.
      $pos = strpos($matches[3], '-');
      if ($pos!==false)
      {
        $version['patch']       = substr($matches[3], 0, $pos);
        $version['pre-release'] = substr($matches[3], $pos + 1);
      }
      else
      {
        $version['patch']       = $matches[3];
        $version['pre-release'] = '';
      }

      $version['release'] = $version['major'].'.'.$version['minor'].'.'.$version['patch'];
    }

    return $version;
  }
1071686
function(sVersion) {

		if (!sVersion || typeof sVersion !== 'string') {
			return false;
		}

		//Match 0 or 1 of the following symbols - "*" or "-" or the following pattern of digits - "<digit>.<digit><digit>"
		var versionRegEx = /^\*$|^\-$|^\d\.\d\d$/;

		if (sVersion.match(versionRegEx)) {
			return true;
		}

		return false;

	}