On Fri, Apr 27, 2007 at 08:59:49PM +0900, Ruby Quiz wrote: > The first check people often do is to validate that the card matches a known > pattern from one of the accepted card providers. Some of these patterns are: > > +============+=============+===============+ > | Card Type | Begins With | Number Length | > +============+=============+===============+ > | AMEX | 34 or 37 | 15 | > +------------+-------------+---------------+ > | Discover | 6011 | 16 | > +------------+-------------+---------------+ > | MasterCard | 51-55 | 16 | > +------------+-------------+---------------+ > | Visa | 4 | 13 or 16 | > +------------+-------------+---------------+ Wikipedia has a great chart showing all the prefixes of most known credit cards, along with lengths and overlap between cards (currently none). http://en.wikipedia.org/wiki/Credit_card_number enjoy, -jeremy -- ======================================================================== Jeremy Hinegardner jeremy / hinegardner.org