Title |
Test
Find
Pattern Title
|
Expression |
^\d{9}[\d|X]$ |
Description |
A very simple ISBN validation expression - it just checks for a 10 digit number where the last digit could also be a capital 'X'. Complete specs for ISBN available here:
http://www.isbn.org/standards/home/isbn/international/html/usm4.htm. An enhancement would be to allow exactly 3 or 0 hyphens or 3 or 0 spaces, since these are also valid formats. |
Matches |
1234123412 | 123412341X |
Non-Matches |
not an isbn |
Author |
Rating:
Not yet rated.
Steven Smith
|
Source |
|
Your Rating |
|
Title: Not quite perfect ...
Name: Luke Arms
Date: 7/15/2004 2:52:36 AM
Comment:
I might be wrong here, but doesn't this pattern allow something like:
123456789|
I think it needs to be:
^\d{9}[\dX]$
:)
Title: Should've mentioned...
Name: Darren Neimke
Date: 3/14/2004 7:02:51 AM
Comment:
I've got a more comprehensive ISBN pattern here:
http://localhost/RegexLib/REDetails.aspx?regexp_id=487
The comments for that pattern also contains a link to some stuff which I blog'ged about ISBN's some time ago.
Title: Simple but nice
Name: Darren Neimke
Date: 3/14/2004 6:42:18 AM
Comment:
Like it Steve, this would certainly fall under the 80/20 rule.