Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
what is ISBN NO(FOR Book)proper validation(Regular expression validation)n asp.net.
As Ex:-978-0-12-345678-9
978-0-12-345678-9
978-1-234-56789-7
9781234567897
978 1 234 56789 7
Plz Help me
Thanks In advance
Posted
Comments
Sandeep Mewara 26-Dec-12 13:16pm    
have you tried to write a regular expression for it by yourself so far?

You can't properly check an ISBN with a regex - the number contains a check digit which a proper validation should verify.
Because this requires a calculation, you cannot verify it with a regex - you need to use code.

You can do a simple validation to check it has the right number of digits and ignore the spaces/hyphens but that's about all you can do.
 
Share this answer
 
As Griff mentioned, it is not the way to do it. For pure syntactical validation, see these ones: http://regexlib.com/Search.aspx?k=ISBN&AspxAutoDetectCookieSupport=1[^]

In theory, since calculation is just a symbol manipulation, and we have look-around in regexp, I think it could be done. But it would be a hell of an expression :) Maybe I will try to do it sometimes. But until than you will need to use a CustomValidator[^].

The checksum calculation logic can be found here: http://en.wikipedia.org/wiki/International_Standard_Book_Number[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900