Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 14. Validation, Formatting, and ... > Use Regular Expressions for Matching...

recipe 14.7. Use Regular Expressions for Matching Credit Card Numbers

14.7.1. Problem

You need a regular expression that will match the major credit card types: Visa, MasterCard, American Express, and Discover.

14.7.2. Solution

Create a regular expression that uses the initial digits of each major credit card type and match the expected number of digits for each type.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial