Sebb created VALIDATOR-414:
------------------------------

             Summary: Simplify CreditCard validation
                 Key: VALIDATOR-414
                 URL: https://issues.apache.org/jira/browse/VALIDATOR-414
             Project: Commons Validator
          Issue Type: Improvement
          Components: CreditCard
            Reporter: Sebb


It's tricky validating Credit card numbers using only regular expressions.

It would be a lot simpler to check the syntax (digits only) and length, and 
then validate the IIN (initial 6 digits) separately using numeric ranges.

No need even to convert the strings to numbers, because string comparison would 
work just as well.

Unfortunately CreditCardValidator uses the final class CodeValidator in its 
public API, but the latter can accept a RegexValidator which can be subclassed 
to provide the necessary functionality. This should be possible without further 
exposing the internal workings.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to