Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

semver-regex

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semver-regex - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

license

4

index.js
'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)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc