RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find ISBN-10
Expression
ISBN\x20(?=.{13}$)\d{1,5}([- ])\d{1,7}\1\d{1,6}\1(\d|X)$
Description
This RE validates the format of an ISBN number
Matches
ISBN 0 93028 923 4 | ISBN 1-56389-668-0 | ISBN 1-56389-016-X
Non-Matches
123456789X | ISBN 9-87654321-2 | ISBN 123 456-789X
Author Rating: Not yet rated. Michael Ash
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: ISSN
Name: Henk de Ridder
Date: 11/26/2011 1:26:34 PM
Comment:
What would be the way to go for magazine ISSN's? For example 0000-0051, 1534-0481 or something ending on an X? The last figure is a checkdigit, but I know regexps don not calculate, so we'll just have to do the shape...


Title: ISBN-10
Name: Michael Ash
Date: 9/15/2006 3:19:15 PM
Comment:
If you follow this link http://www.isbn.org/standards/home/isbn/international/html/usm4.htm it explains how the various part of an ISBN can vary in length but in the end has 10 digits. The regex after finding the string ISBN (followed by a space) has 13 characters to the end of the string which is the length of the digit and separators, then finds the remaining parts of the ISBN in their allowed length range.


Title: ISBN-10
Name: habeeb
Date: 7/22/2006 1:03:45 AM
Comment:
Hi, Can u explain the ISBN RE pattern in detail?


Title: Re: Modulus 10
Name: Michael Ash
Date: 2/28/2005 1:27:04 PM
Comment:
ISBN uses a modulus 11 for it's check digit. See http://www.isbn.org/standards/home/isbn/international/html/usm4.htm This regex doesn't validate if the check digit is good or not.


Title: Modulo 10
Name: zingmatter
Date: 2/28/2005 1:05:47 PM
Comment:
The last digit is a modulo 14(? not sure) check digit.


Title: re:Doesn't limit digits properly
Name: Michael Ash
Date: 5/14/2004 12:17:40 PM
Comment:
Please provide an example of this.


Title: Doesn't limit digits properly
Name: Tim
Date: 5/14/2004 11:50:31 AM
Comment:
The RE does not properly limit the number of digits. You can end up with a 14 digit ISBN that will match with this pattern.


Title: Nice Pattern
Name: Darren Neimke
Date: 12/9/2003 6:03:21 AM
Comment:
Nice job Michael! :-)


Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials