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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find ISBNs
Expression
ISBN(-1(?:(0)|3))?:?\x20+(?(1)(?(2)(?:(?=.{13}$)\d{1,5}([ -])\d{1,7}\3\d{1,6}\3(?:\d|x)$)|(?:(?=.{17}$)97(?:8|9)([ -])\d{1,5}\4\d{1,7}\4\d{1,6}\4\d$))|(?(.{13}$)(?:\d{1,5}([ -])\d{1,7}\5\d{1,6}\5(?:\d|x)$)|(?:(?=.{17}$)97(?:8|9)([ -])\d{1,5}\6\d{1,7}\6\d{1,6}\6\d$)))
Description
This regex match both the old 10 digit ISBNs and the new 13 digit ISBNs. The ISBN number must be prefixed by the literal text "ISBN:" or "ISBN-10:" or "ISBN-13:". The colon is optional. Naturally an ISBN prefixed by "ISBN-10" must be a 10 digit ISBN. One prefixed by "ISBN-13" must be 13 digits. If prefixed only by "ISBN:" it can be either 10 or 13 digits. This does not evaluate whether the check digit is valid for the given ISBN. The structure of an ISBN is discribed here http://www.isbn.org/standards/home/isbn/international/html/usm4.htm (this is for 10 digit)
Matches
ISBN-13: 978-1-4028-9462-6
Non-Matches
ISBN: 1284233-2-1-1
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: Doesn't work
Name: Roger
Date: 10/11/2012 11:24:46 AM
Comment:
Throws a warning in PHP: Compilation failed: assertion expected after (?( at offset 154.


Title: Sneakers Isabel Marant
Name: Sneakers Isabel Marant
Date: 10/8/2012 8:17:57 PM
Comment:
Chaussures Isabel Marant http://www.isabelmarant-bottes.com Sneakers Isabel Marant http://www.isabelmarant-bottes.com Sneakers Isabel Marant pas cher http://www.isabelmarant-bottes.com


Title: Sneakers Isabel Marant
Name: Sneakers Isabel Marant
Date: 10/8/2012 8:17:46 PM
Comment:
Chaussures Isabel Marant http://www.isabelmarant-bottes.com Sneakers Isabel Marant http://www.isabelmarant-bottes.com Sneakers Isabel Marant pas cher http://www.isabelmarant-bottes.com


Title: This didn't work
Name: Jude
Date: 11/26/2010 9:52:31 PM
Comment:
When I tried the above RegEx expression with regexpal (www.regexpal.com), it didn't work. It would be great if RegExLib.com could offer an online RegEx tool for validation.


Title: This didn't work
Name: Jude
Date: 11/26/2010 9:47:54 PM
Comment:
When I tried the above RegEx expression with regexpal (www.regexpal.com), it didn't work. It would be great if RegExLib.com could offer an online RegEx tool for validation.


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