Click here to Skip to main content
13,355,538 members (71,906 online)
Rate this:
Please Sign up or sign in to vote.
See more:
what is ISBN NO(FOR Book)proper validation(Regular expression validation)n
As Ex:-978-0-12-345678-9
978 1 234 56789 7
Plz Help me
Thanks In advance
Posted 26-Dec-12 7:57am
Sandeep Mewara 26-Dec-12 13:16pm
have you tried to write a regular expression for it by yourself so far?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

As Griff mentioned, it is not the way to do it. For pure syntactical validation, see these ones:[^]

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:[^]

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.180111.1 | Last Updated 26 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100