From: James Edward Gray II Date: 2007-04-28T03:20:03+09:00 Subject: Re: [QUIZ] Checking Credit Cards (#122) On Apr 27, 2007, at 12:58 PM, Matthew Moss wrote: >> +============+=============+===============+ >> | Card Type | Begins With | Number Length | >> +============+=============+===============+ >> | AMEX | 34 or 37 | 15 | >> +------------+-------------+---------------+ >> | Discover | 6011 | 16 | >> +------------+-------------+---------------+ >> | MasterCard | 51-55 | 16 | >> +------------+-------------+---------------+ >> | Visa | 4 | 13 or 16 | >> +------------+-------------+---------------+ > > So is a card number like "4012 3456 7890" a valid Unknown, or an > invalid Visa? Visa Invalid Always match the type first. > Similarly, for Unknown, should we accept any length, or go for the > common 16? Unknown is for any type that doesn't match, so it could be any length. James Edward Gray II