Regex for DOI Number
Regex Pattern
^10\.\d{4,9}\/[-._;()/:a-zA-Z0-9]+$Digital Object Identifier (DOI) starting with 10.
Quick Answer
The regex pattern for doi number is `^10\.\d{4,9}\/[-._;()/:a-zA-Z0-9]+$`. Digital Object Identifier (DOI) starting with 10.. This works in JavaScript, Python, Ruby, PHP, Java, and most regex engines that support PCRE syntax.
Test Examples
| Input | Result |
|---|---|
| 10.1000/xyz123 | ✓ Matches |
| 10.1038/nphys1170 | ✓ Matches |
| 10.1016/j.cell.2009.01.001 | ✓ Matches |
| 11.1000/xyz | ✗ No match |
| 10.12/x | ✗ No match |
| not-a-doi | ✗ No match |
Code Examples
javascript
const regex = /^10\.\d{4,9}\\/[-._;()\/:a-zA-Z0-9]+$/;
const isValid = regex.test(value);python
import re
pattern = r'^10\.\d{4,9}\/[-._;()/:a-zA-Z0-9]+$'
if re.match(pattern, value):
print("valid")ruby
pattern = /^10\.\d{4,9}\/[-._;()/:a-zA-Z0-9]+$/
if value =~ pattern
puts "valid"
endphp
if (preg_match('/^10\.\d{4,9}\\/[-._;()\/:a-zA-Z0-9]+$/', $value)) {
echo "valid";
}java
String pattern = "^10\\.\\d{4,9}\\/[-._;()/:a-zA-Z0-9]+$";
boolean isValid = value.matches(pattern);Frequently Asked Questions
Related Regex Patterns
UUID v4
UUID version 4 (randomly generated)
UUID (Any Version)
Any RFC 4122 UUID (versions 1-5)
JWT Token
JSON Web Token (header.payload.signature)
Hex String
Any-length hexadecimal string
Base64 String
Standard base64 encoded string
Alphanumeric Username
Username with letters, digits, underscores (3-16 chars)