Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

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

Description

Regex that matches the old ISBN-10 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-10-digit-isbn.html and the International ISBN Agency user's manual.

Submitted by Alejandro - 2 years ago