All Projects → regexhq → doi-regex

regexhq / doi-regex

Licence: MIT license
Regular expression for matching DOIs

Programming Languages

HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to doi-regex

regex-not
Create a javascript regular expression for matching everything except for the given string.
Stars: ✭ 31 (+10.71%)
Mutual labels:  regex, regular-expression
compiler-design-lab
These are my programs for compiler design lab work in my sixth semester
Stars: ✭ 47 (+67.86%)
Mutual labels:  regex, regular-expression
Micromatch
Contributing Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. Please read the contributing guide for advice on opening issues, pull requests, and coding standards.
Stars: ✭ 1,979 (+6967.86%)
Mutual labels:  regex, regular-expression
FileRenamerDiff
A File Renamer App featuring a difference display before and after the change.
Stars: ✭ 32 (+14.29%)
Mutual labels:  regex, regular-expression
Regex For Regular Folk
🔍💪 Regular Expressions for Regular Folk — A visual, example-based introduction to RegEx [BETA]
Stars: ✭ 242 (+764.29%)
Mutual labels:  regex, regular-expression
Orchestra
One language to be RegExp's Successor. Visually readable and rich, technically safe and extended, naturally scalable, advanced, and optimized
Stars: ✭ 103 (+267.86%)
Mutual labels:  regex, regular-expression
Grex
A command-line tool and library for generating regular expressions from user-provided test cases
Stars: ✭ 4,847 (+17210.71%)
Mutual labels:  regex, regular-expression
Hyperscan Java
Match tens of thousands of regular expressions within milliseconds - Java bindings for Intel's hyperscan 5
Stars: ✭ 66 (+135.71%)
Mutual labels:  regex, regular-expression
Regaxor
A regular expression fuzzer.
Stars: ✭ 35 (+25%)
Mutual labels:  regex, regular-expression
Regexpu
A source code transpiler that enables the use of ES2015 Unicode regular expressions in ES5.
Stars: ✭ 201 (+617.86%)
Mutual labels:  regex, regular-expression
moar
Deterministic Regular Expressions with Backreferences
Stars: ✭ 19 (-32.14%)
Mutual labels:  regex, regular-expression
learn-regex
Learn regex the easy way
Stars: ✭ 43,660 (+155828.57%)
Mutual labels:  regex, regular-expression
To Regex Range
Pass two numbers, get a regex-compatible source string for matching ranges. Fast compiler, optimized regex, and validated against more than 2.78 million test assertions. Useful for creating regular expressions to validate numbers, ranges, years, etc.
Stars: ✭ 97 (+246.43%)
Mutual labels:  regex, regular-expression
Js Regular Expression Awesome
📄我收藏的正则表达式大全,欢迎补充
Stars: ✭ 120 (+328.57%)
Mutual labels:  regex, regular-expression
Globbing
Introduction to "globbing" or glob matching, a programming concept that allows "filepath expansion" and matching using wildcards.
Stars: ✭ 86 (+207.14%)
Mutual labels:  regex, regular-expression
Regex Dos
👮 👊 RegEx Denial of Service (ReDos) Scanner
Stars: ✭ 143 (+410.71%)
Mutual labels:  regex, regular-expression
Regexr
For composing regular expressions without the need for double-escaping inside strings.
Stars: ✭ 53 (+89.29%)
Mutual labels:  regex, regular-expression
Emoji Regex
A regular expression to match all Emoji-only symbols as per the Unicode Standard.
Stars: ✭ 1,134 (+3950%)
Mutual labels:  regex, regular-expression
Regex.persian.language
Collection of Regex for validating, filtering, sanitizing and finding Persian strings
Stars: ✭ 172 (+514.29%)
Mutual labels:  regex, regular-expression
regex-comuns
Um estudo de regex comuns
Stars: ✭ 15 (-46.43%)
Mutual labels:  regex, regular-expression

doi-regex

Build Status FOSSA Status

Regular expression for matching DOIs

Parts of a DOI:

  • Directory Identifier: 10
  • Registrant code: . + [0-9]{2,}
  • Registrant subdivision (optional): . + [0-9]+
  • Suffix: / + any character, case insensitive for ASCII chars (but capitalised in the registry), with some characters that should be escaped
    Recommended encoding: "{}^[]`|\\&\/\'<>
    Mandatory encoding: %"#? and space.

From: http://www.doi.org/doi_handbook/2_Numbering.html#2.2

Install

$ npm install --save doi-regex

Usage

var doiRegex = require('doi-regex');

// contains a DOI
doiRegex().test('unicorn 10.1000/xyz000');
//=> true

// is a DOI address
doiRegex({exact: true}).test('unicorn 10.1000/xyz000');
//=> false

doiRegex.declared({exact: true}).test('doi:10.1000/xyz000');
//=> true

doiRegex.groups().test('10.1000/xyz1000.a001');
//=> ['10.1000/xyz1000', '10.1000/xyz1000', '.a001']

'unicorn 10.1000/xyz000 cake 10.1000/xyz001 rainbow'.match(doiRegex());
//=> ['10.1000/xyz000', '10.1000/xyz001']

API

doiRegex(options)

Returns a regex for matching a DOI.

doiRegex.declared(options)

Returns a regex for matching a DOI that has been declared with a doi: string in front.

doiRegex.groups(doi)

Returns 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.

options.exact

Type: boolean
Default: false (Matches any DOI in a string)

Only match an exact string.
Useful with RegExp#test to check if a string is an DOI.

CLI

A CLI file has been provided. Run any of the examples provided above using your own DOI. For instance:

$ node cli-index.js -e 10.000/xyz1000
//=> true

Possible Flags:

  • -e, --exact Find an exact match
  • -d, --declared Find a DOI with a 'doi:' prefix
  • -m, --match Find all matches within the given string
  • -g, --groups Find the stripped DOI and any suffix it might have
  • -h, --help Display usage

Contribute

Please do!

License

MIT © Richard Littauer

FOSSA Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].