{"id":21214764,"url":"https://github.com/regexhq/doi-regex","last_synced_at":"2026-01-02T22:08:26.112Z","repository":{"id":24064934,"uuid":"27451124","full_name":"regexhq/doi-regex","owner":"regexhq","description":"Regular expression for matching DOIs","archived":false,"fork":false,"pushed_at":"2024-06-14T16:11:19.000Z","size":357,"stargazers_count":31,"open_issues_count":0,"forks_count":5,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-05T02:02:33.037Z","etag":null,"topics":["doi","doi-regex","regex","regular-expression"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/regexhq.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-12-02T20:08:58.000Z","updated_at":"2025-01-14T15:00:30.000Z","dependencies_parsed_at":"2024-11-20T21:41:48.911Z","dependency_job_id":null,"html_url":"https://github.com/regexhq/doi-regex","commit_stats":null,"previous_names":["beaglelab/doi"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regexhq%2Fdoi-regex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regexhq%2Fdoi-regex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regexhq%2Fdoi-regex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regexhq%2Fdoi-regex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/regexhq","download_url":"https://codeload.github.com/regexhq/doi-regex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243663883,"owners_count":20327374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["doi","doi-regex","regex","regular-expression"],"created_at":"2024-11-20T21:30:39.679Z","updated_at":"2026-01-02T22:08:26.095Z","avatar_url":"https://github.com/regexhq.png","language":"HTML","readme":"# doi-regex\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fregexhq%2Fdoi-regex.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fregexhq%2Fdoi-regex?ref=badge_shield)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.11164917.svg)](https://zenodo.org/doi/10.5281/zenodo.11164917)\n\n\u003e Regular expression for matching DOIs\n\nParts of a DOI:\n * Directory Identifier: 10\n * Registrant code: . + [0-9]{2,}\n * Registrant subdivision (optional): . + [0-9]+\n * Suffix: / + any character, case insensitive for ASCII chars (but capitalised\n\tin the registry), with some characters that _should_ be escaped  \n\tRecommended encoding: ```\"{}^[]`|\\\\\u0026\\/\\'\u003c\u003e```  \n \tMandatory encoding: ```%\"#?``` and space.\n\nFrom: http://www.doi.org/doi_handbook/2_Numbering.html#2.2\n\n\n## Install\n\n```sh\n$ npm install --save doi-regex\n```\n\n\n## Usage\n\n```js\nvar doiRegex = require('doi-regex');\n\n// contains a DOI\ndoiRegex().test('unicorn 10.1000/xyz000');\n//=\u003e true\n\n// is a DOI address\ndoiRegex({exact: true}).test('unicorn 10.1000/xyz000');\n//=\u003e false\n\ndoiRegex.declared({exact: true}).test('doi:10.1000/xyz000');\n//=\u003e true\n\ndoiRegex.groups().test('10.1000/xyz1000.a001');\n//=\u003e ['10.1000/xyz1000', '10.1000/xyz1000', '.a001']\n\n'unicorn 10.1000/xyz000 cake 10.1000/xyz001 rainbow'.match(doiRegex());\n//=\u003e ['10.1000/xyz000', '10.1000/xyz001']\n```\n\n\n## API\n\n### doiRegex(options)\n\nReturns a regex for matching a DOI.\n\n### doiRegex.declared(options)\n\nReturns a regex for matching a DOI that has been declared with a `doi:` string in front.\n\n### doiRegex.groups(doi)\n\nReturns a regex match object with a final string as the first two indices, and any suffixes that are commonly used for supplemental information if they are attached to the doi. For instance, `10.1000/journal.pone.0000000.g001` would return `10.1000/journal.pone.0000000` and `.g001`. \n\n#### options.exact\n\nType: `boolean`  \nDefault: `false` *(Matches any DOI in a string)*\n\nOnly match an exact string.  \nUseful with `RegExp#test` to check if a string is an DOI.\n\n\n## CLI \n\nA CLI file has been provided. Run any of the examples provided above using your own DOI. For instance: \n\n```sh\n$ node cli-index.js -e 10.000/xyz1000\n//=\u003e true\n```\n\nPossible Flags:\n\n* `-e`, `--exact`\tFind an exact match\n* `-d`, `--declared` \tFind a DOI with a 'doi:' prefix\n* `-m`, `--match`\tFind all matches within the given string\n* `-g`, `--groups` Find the stripped DOI and any suffix it might have\n* `-h`, `--help` Display usage\n\n## Contribute\n\nPlease do!\n\n## License\n\nMIT © [Richard Littauer](http://burntfen.com)\n\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fregexhq%2Fdoi-regex.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fregexhq%2Fdoi-regex?ref=badge_large)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fregexhq%2Fdoi-regex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fregexhq%2Fdoi-regex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fregexhq%2Fdoi-regex/lists"}