Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
^(?:ISBN(?:-13)?:? )?(?<gs1>\d{3})(?:(?<number>\d{9})|(?=[\d -]{14}$)[ -](?<registrationGroup>\d{1,5})[ -](?<registrant>\d{1,7})[ -](?<publication>\d{1,6})[ -])(?<checkDigit>\d)$
/
gm

Description

Regex that matches the new (as of 2007) ISBN-13 format and captures all relevant groups. It does not verify that the ISBN is valid though. The format specification is based on the following website: https://isbn-information.com/the-13-digit-isbn.html and the International ISBN Agency user's manual.

Submitted by Alejandro - 2 years ago