Skip to content

Commit

Permalink
Merge pull request #219 from spicyyboi/doi
Browse files Browse the repository at this point in the history
Add DOI support
  • Loading branch information
bee-san authored Oct 22, 2021
2 parents ec34001 + cb319bc commit e9bf98c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fixtures/file
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,6 @@ otpauth://totp/Example:[email protected]?secret=JBSWY3DPEHPK3PXP&issuer=Example
sshpass -p MyPassw0RD! ssh [email protected]

https://hooks.slack.com/services/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

doi:10.1392/BC1.0
10.1000/123
18 changes: 18 additions & 0 deletions pywhat/Data/regex.json
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,24 @@
"Invalid": []
}
},
{
"Name": "Digital Object Identifier (DOI)",
"Regex": "^((?:https?:\\/\\/(?:(?:www\\.)?doi\\.org\\/)|doi:)?(10\\.[1-9][0-9]{3}[0-9]*\\/\\S+[^;,.\\s]))$",
"plural_name": false,
"Description": null,
"Rarity": 0.7,
"URL": null,
"Tags": [
"Identifiers",
"Media"
],
"Examples": {
"Valid": [
"10.1000/182",
"doi:10.1002/0470841559.ch1"
]
}
},
{
"Name": "Internet Protocol (IP) Address Version 6",
"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})?)$",
Expand Down
7 changes: 7 additions & 0 deletions tests/test_click.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,13 @@ def test_file_fixture_xmr():
assert re.findall("Monero", str(result.output))


def test_file_fixture_doi():
runner = CliRunner()
result = runner.invoke(main, ["-db", "fixtures/file"])
assert result.exit_code == 0
assert re.findall("DOI", str(result.output))


def test_file_cors():
runner = CliRunner()
result = runner.invoke(main, ["-db", "Access-Control-Allow: *"])
Expand Down

0 comments on commit e9bf98c

Please sign in to comment.