Validationflags: g
ISBN-13
Match 13-digit ISBNs starting with 978 or 979, with optional hyphens or spaces.
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
\b97[89][\- ]?(?:\d[\- ]?){9}\d\b (flags: g)Raw source: \b97[89][\- ]?(?:\d[\- ]?){9}\d\b
How it works
The 978 or 979 GS1 prefix anchors the match, followed by nine digits (with optional separators) and a final check digit.
Examples
Input
978-0-306-40615-7Matches
978-0-306-40615-7
Input
9780306406157Matches
9780306406157
Common use cases
- •Modern book catalog validation
- •Retail inventory systems
- •Publisher metadata ingestion
- •ISBN format conversion pipelines
Related patterns
ISBN-10
ValidationMatch 10-digit ISBNs, allowing optional hyphens or spaces between groups.
Credit Card Number
ValidationMatch 16-digit credit card numbers with optional spaces or hyphens between groups of 4.
Alphanumeric Only
ValidationMatch strings containing only letters (A–Z, a–z) and digits (0–9), with no spaces or special characters.
International Phone (E.164)
ValidationValidate phone numbers in ITU-T E.164 international format: a + sign followed by 2–15 digits, first digit non-zero.