Skip to content

Commit e9bf98c

Browse files
authored
Merge pull request #219 from spicyyboi/doi
Add DOI support
2 parents ec34001 + cb319bc commit e9bf98c

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

fixtures/file

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,6 @@ otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example
9898
sshpass -p MyPassw0RD! ssh root@10.0.0.10
9999

100100
https://hooks.slack.com/services/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
101+
102+
doi:10.1392/BC1.0
103+
10.1000/123

pywhat/Data/regex.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,24 @@
13591359
"Invalid": []
13601360
}
13611361
},
1362+
{
1363+
"Name": "Digital Object Identifier (DOI)",
1364+
"Regex": "^((?:https?:\\/\\/(?:(?:www\\.)?doi\\.org\\/)|doi:)?(10\\.[1-9][0-9]{3}[0-9]*\\/\\S+[^;,.\\s]))$",
1365+
"plural_name": false,
1366+
"Description": null,
1367+
"Rarity": 0.7,
1368+
"URL": null,
1369+
"Tags": [
1370+
"Identifiers",
1371+
"Media"
1372+
],
1373+
"Examples": {
1374+
"Valid": [
1375+
"10.1000/182",
1376+
"doi:10.1002/0470841559.ch1"
1377+
]
1378+
}
1379+
},
13621380
{
13631381
"Name": "Internet Protocol (IP) Address Version 6",
13641382
"Regex": "^((?=.*[0-9])\\[?(?:(?:[0-9a-f]{1,4}:){7,7}[0-9a-f]{1,4}|([0-9a-f]{4}:){1,7}:|([0-9a-f]{1,4}:){1,6}:[0-9a-f]{1,4}|([0-9a-f]{1,4}:){1,5}(:[0-9a-f]{1,4}){1,2}|([0-9a-f]{1,4}:){1,4}(:[0-9a-f]{1,4}){1,3}|([0-9a-f]{1,4}:){1,3}(:[0-9a-f]{1,4}){1,4}|([0-9a-fA]{1,4}:){1,2}(:[0-9a-f]{1,4}){1,5}|[0-9a-f]{1,4}:((:[0-9a-f]{1,4}){1,6})|:((:[0-9a-f]{1,4}){1,7}|:)|fe80:(:[0-9a-f]{0,4}){0,4}%[0-9a-z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|(?:[0-9a-f]{1,4}:){1,4}:(?:(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\]?(?::[0-9]{1,5})?)$",

tests/test_click.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,13 @@ def test_file_fixture_xmr():
350350
assert re.findall("Monero", str(result.output))
351351

352352

353+
def test_file_fixture_doi():
354+
runner = CliRunner()
355+
result = runner.invoke(main, ["-db", "fixtures/file"])
356+
assert result.exit_code == 0
357+
assert re.findall("DOI", str(result.output))
358+
359+
353360
def test_file_cors():
354361
runner = CliRunner()
355362
result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])

0 commit comments

Comments
 (0)