Skip to content

Commit 9a445f1

Browse files
Allow all registrant codes
1 parent 7279c7b commit 9a445f1

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Parts of a DOI:
55
* Directory Identifier: 10
6-
* Registrant code: . + [0-9]{4,}
6+
* Registrant code: . + [0-9]{2,}
77
* Registrant subdivision (optional): . + [0-9]+
88
* Suffix: / + any character, case insensitive for ASCII chars (but capitalised
99
* in the registry), with some characters that _should_ be escaped.
@@ -14,7 +14,7 @@
1414

1515
// TODO Capture final segment for fragments
1616
// (\\.[a-zA-Z]{1}[0-9]{3})?
17-
var doiRegex = '(10[.][0-9]{4,}(?:[.][0-9]+)*/(?:(?![%"#? ])\\S)+)'
17+
var doiRegex = '(10[.][0-9]{2,}(?:[.][0-9]+)*/(?:(?![%"#? ])\\S)+)'
1818
var doiTextPrefix = 'doi\\:'
1919

2020
var doi = module.exports = function (opts) {

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
Parts of a DOI:
99
* Directory Identifier: 10
10-
* Registrant code: . + [0-9]{4,}
10+
* Registrant code: . + [0-9]{2,}
1111
* Registrant subdivision (optional): . + [0-9]+
1212
* Suffix: / + any character, case insensitive for ASCII chars (but capitalised
1313
in the registry), with some characters that _should_ be escaped

spec/test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ var doi = [
88
'10.0001/journal.pone.000001',
99
'10.0001/journal/pone.0011111',
1010
'10.0001.112/journal.pone.0011021',
11-
'10.0001/issn.10001'
11+
'10.0001/issn.10001',
12+
'10.10.123/456'
1213
]
1314

1415
var doiOlderFormat = [

0 commit comments

Comments
 (0)