Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static final String DinersClubCreditCardPattern = "^3(?:0[0-5]|[68][0-9])[0-9]{11}$"; private static boolean isDinersClubCard(String creditCardNumber) { Pattern pattern = Pattern.compile(DinersClubCreditCardPattern); Matcher matcher = pattern.matcher(creditCardNumber); return matcher.find(); } }