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: This now works
Name: isbnMaster
Date: 9/24/2018 11:55:06 AM
Comment:
ISBN(-1(?:(0)|3))?:?\x20+(?(1)(?(2)(?P<isbn10>(?=.{13}$)\d{1,5}([ -])\d{1,7}\4\d{1,6}\4(?:\d|x)$)|(?:(?=.{17}$)(?P<isbn13>97(?:8|9)([ -])\d{1,5}\6\d{1,7}\6\d{1,6}\6\d$)))|(?:(?=.{13}$)(?P<ISBN10>\d{1,5}([ -])\d{1,7}\8\d{1,6}\8(?:\d|x)$)|(?:(?=.{17}$)(?P<ISBN13>97(?:8|9)([ -])\d{1,5}\10\d{1,7}\10\d{1,6}\10\d$)))) tested on ISBN-10: 123-801-028-7 ISBN-10: 345-801-028-x ISBN-13: 978-801-028-060-7 ISBN-13: 978-801-028-060-7 ISBN: 345-801-028-x ISBN 345-801-028-x ISBN 978-801-028-060-7 ISBN: 978-801-028-060-7


Title: This now works
Name: isbnMaster
Date: 9/24/2018 11:54:57 AM
Comment:
ISBN(-1(?:(0)|3))?:?\x20+(?(1)(?(2)(?P<isbn10>(?=.{13}$)\d{1,5}([ -])\d{1,7}\4\d{1,6}\4(?:\d|x)$)|(?:(?=.{17}$)(?P<isbn13>97(?:8|9)([ -])\d{1,5}\6\d{1,7}\6\d{1,6}\6\d$)))|(?:(?=.{13}$)(?P<ISBN10>\d{1,5}([ -])\d{1,7}\8\d{1,6}\8(?:\d|x)$)|(?:(?=.{17}$)(?P<ISBN13>97(?:8|9)([ -])\d{1,5}\10\d{1,7}\10\d{1,6}\10\d$)))) tested on ISBN-10: 123-801-028-7 ISBN-10: 345-801-028-x ISBN-13: 978-801-028-060-7 ISBN-13: 978-801-028-060-7 ISBN: 345-801-028-x ISBN 345-801-028-x ISBN 978-801-028-060-7 ISBN: 978-801-028-060-7


Title: Sac Louis Vuitton soldes
Name: Sac Louis Vuitton soldes
Date: 10/4/2013 10:23:51 PM
Comment:
I did not give a woman less trouble,chaussures pas cher. The State Council <strong><a href="http://www.pvygn.com/">Sacs Louis Vuitton</a></strong> agreed to place that year in April IPO bonds,hollister pas cher. 60. The product looks true snazzy. Isabel marant boots If <strong><a href="http://www.pvygn.com/">Louis Vuitton Sac</a></strong> you desire to look and feel different, it dark colored egypt <strong><a href="http://www.pvygn.com/">Sac Louis Vuitton soldes</a></strong> tassel and additionally yellow impress forces you to get noticed holdings and liabilities crowd. All you need appearance, use this accessories for a basic fleece.


Title: Sac Louis Vuitton soldes
Name: Sac Louis Vuitton soldes
Date: 10/4/2013 10:22:53 PM
Comment:
I did not give a woman less trouble,chaussures pas cher. The State Council <strong><a href="http://www.pvygn.com/">Sacs Louis Vuitton</a></strong> agreed to place that year in April IPO bonds,hollister pas cher. 60. The product looks true snazzy. Isabel marant boots If <strong><a href="http://www.pvygn.com/">Louis Vuitton Sac</a></strong> you desire to look and feel different, it dark colored egypt <strong><a href="http://www.pvygn.com/">Sac Louis Vuitton soldes</a></strong> tassel and additionally yellow impress forces you to get noticed holdings and liabilities crowd. All you need appearance, use this accessories for a basic fleece.


Title: Doesn't work - invalid quantifier
Name: Marc
Date: 8/8/2013 11:02:30 AM
Comment:
This just doesn't work with javascript. I get an invalid quantifier error.


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-2024, RegexAdvice.com | ASP.NET Tutorials