Skip to content

Commit aeef5b4

Browse files
committed
Fix regexp
1 parent 35fb1d8 commit aeef5b4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

modules/semver.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ import { getType, isString } from './common.js';
1010

1111
/* constants */
1212
const BASE = 10;
13-
const INT = '(?:0|[1-9]\\d*)';
14-
const ALPHA_NUM = '\\d*[A-z-][A-z\\d-]*';
13+
const INT = '0|[1-9]\\d*';
14+
const ALPHA_NUM = '\\d*[A-Za-z-][A-Za-z\\d-]*';
1515
const PRE_PART = `(?:${ALPHA_NUM}|${INT})`;
1616
const PRE = `${PRE_PART}(?:\\.${PRE_PART})*`;
1717
const BUILD_PART = `(?:${ALPHA_NUM}|\\d+)`;
1818
const BUILD = `${BUILD_PART}(?:\\.${BUILD_PART})*`;
19-
const SEMVER = `(${INT}(?:\\.${INT}){2})(?:-(${PRE}))?(?:\\+(${BUILD}))?`;
20-
const REGEXP_INT = new RegExp(`^${INT}$`);
19+
const SEMVER =
20+
`((?:${INT})(?:\\.(?:${INT})){2})(?:-(${PRE}))?(?:\\+(${BUILD}))?`;
21+
const REGEXP_INT = new RegExp(`^(?:${INT})$`);
2122
const REGEXP_SEMVER = new RegExp(`^v?${SEMVER}$`);
2223
const REGEXP_SEMVER_STRICT = new RegExp(`^${SEMVER}$`);
2324

0 commit comments

Comments
 (0)