Regular Expressions 101

Community Patterns

International Standard Book Number


Regular Expression
PCRE2 (PHP >=7.3)

^(?:ISBN(?:-13)?:?\ )?(?=[0-9]{13}$|(?=(?:[0-9]+[-\ ]){4})[-\ 0-9]{17}$)97[89][-\ ]?[0-9]{1,5}[-\ ]?[0-9]+[-\ ]?[0-9]+[-\ ]?[0-9]$


This pattern checks for the format according to the International ISBN Agency standard e.g. '978-3-16-148410-0'. Source: NOTE: it does not validate if it is an actual ISBN number. It only validates the format.

Submitted by Regular Expressions Cookbook, 2nd Edition by Jan Goyvaerts, Steven Levithan - 2 years ago