semver-regex
Advanced tools
Comparing version 1.0.0 to 2.0.0
'use strict'; | ||
module.exports = function () { | ||
return /\bv?(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?\b/ig; | ||
}; | ||
module.exports = () => /\bv?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?\b/ig; |
{ | ||
"name": "semver-regex", | ||
"version": "1.0.0", | ||
"description": "Regular expression for matching semver versions", | ||
"license": "MIT", | ||
"repository": "sindresorhus/semver-regex", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "http://sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"semver", | ||
"version", | ||
"versions", | ||
"regex", | ||
"regexp", | ||
"re", | ||
"match", | ||
"matching", | ||
"semantic" | ||
], | ||
"devDependencies": { | ||
"mocha": "*" | ||
} | ||
"name": "semver-regex", | ||
"version": "2.0.0", | ||
"description": "Regular expression for matching semver versions", | ||
"license": "MIT", | ||
"repository": "sindresorhus/semver-regex", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"semver", | ||
"version", | ||
"versions", | ||
"regex", | ||
"regexp", | ||
"re", | ||
"match", | ||
"matching", | ||
"semantic" | ||
], | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
} |
# semver-regex [![Build Status](https://travis-ci.org/sindresorhus/semver-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/semver-regex) | ||
> Regular expression for matching [semver](https://github.com/isaacs/node-semver) versions | ||
> Regular expression for matching [semver](https://github.com/npm/node-semver) versions | ||
@@ -8,5 +8,5 @@ | ||
```sh | ||
$ npm install --save semver-regex | ||
``` | ||
$ npm install semver-regex | ||
``` | ||
@@ -17,3 +17,3 @@ | ||
```js | ||
var semverRegex = require('semver-regex'); | ||
const semverRegex = require('semver-regex'); | ||
@@ -27,3 +27,3 @@ semverRegex().test('v1.0.0'); | ||
semverRegex().exec('unicorn 1.0.0 rainbow')[0]; | ||
//=> 1.0.0 | ||
//=> '1.0.0' | ||
@@ -34,7 +34,14 @@ 'unicorn 1.0.0 and rainbow 2.1.3'.match(semverRegex()); | ||
*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.* | ||
## Related | ||
- [find-versions](https://github.com/sindresorhus/find-versions) - Find semver versions in a string | ||
- [latest-semver](https://github.com/sindresorhus/latest-semver) - Get the latest stable semver version from an array of versions | ||
- [to-semver](https://github.com/sindresorhus/to-semver) - Get an array of valid, sorted, and cleaned semver versions from an array of strings | ||
- [semver-diff](https://github.com/sindresorhus/semver-diff) - Get the diff type of two semver versions: `0.0.1` `0.0.2` → `patch` | ||
- [semver-truncate](https://github.com/sindresorhus/semver-truncate) - Truncate a semver version: `1.2.3` → `1.2.0` | ||
## License | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3154
4
44
2
2