You are not Logged in
Would you like to Login or Register

Today is: 03 September 2010
Check this months hot topics

ISBN Number regular expression

string pattern = @"ISBN\x20(?=.{13}$)\d{1,5}([- ])\d{1,7}\1\d{1,6}\1(\d|X)$";

Examples

// Valid
Console.WriteLine(Regex.IsMatch(@"ISBN 0 93028 923 4"@"ISBN\x20(?=.{13}$)\d{1,5}([- ])\d{1,7}\1\d{1,6}\1(\d|X)$"));

// Valid
Console.WriteLine(Regex.IsMatch(@"ISBN 1-56389-668-0"@"ISBN\x20(?=.{13}$)\d{1,5}([- ])\d{1,7}\1\d{1,6}\1(\d|X)$"));

// Invalid
Console.WriteLine(Regex.IsMatch(@"ISBN 123 456-789X"@"ISBN\x20(?=.{13}$)\d{1,5}([- ])\d{1,7}\1\d{1,6}\1(\d|X)$"));
kick it on DotNetKicks.com del.icio.us digg Mister Wong YahooMyWeb Reddit Furl Spurl blogmarks
Paul Hayman Skype
Author : Paul Hayman
Published : 04 August 2006

Paul is the COO of kwiboo ltd consultant and has more than a decade of IT consultancy experience. He has consulted for a number of blue chip companies and has been exposed to the folowing sectors: Utilities, Telecommunications, Insurance, Media, Investment Banking, Leisure, Legal, CRM, Pharmaceuticals, Interactive Gaming, Mobile Communications, Online Services. Paul is the COO and co-founder of kwiboo (http://www.kwiboo.com/) and is also the creator of GeekZilla.

Comments

ethemsulan said:

Hi, ISBN format is 978-9944-300-19-3 Can you help me for regular expression? Thanks

April 28, 2010 - 10:15 PM

Add Comment

Enter your comment below and it will be submitted for moderation.

Your Name

Add Tag

Please enter tags for this article, seperated by semi-colon ;

View Tag's by : # articles | # views

More Publications

URL Regular Expression
Paul Hayman - 26/07/2006
IP Address regular expression
Paul Hayman - 04/08/2006
IsGuid() (Regular Expression Guid Match)
Paul Hayman - 14/06/2006
Hex code Regular Expression (#F0F0F0)
Paul Hayman - 12/10/2007
ISBN Number regular expression
Paul Hayman - 04/08/2006