This features allows you to define the regular expression (regex) pattern to be used while validating the card information on client-side. The advantage of this feature is that (1) you have a fine grained control of what cards numbers are accepted or not and (2) the validation is made on the client side (on user’s browser) which reduces the unnecessary round-trips to the Braintree gateway in case of erroneous user input. Regardless of how this validation is done the Braintree will ALWAYS make their validations (which is what we all want, don’t we?).
When a card number matches a specific pattern it is considered that the card has that particular type (ie. if it matches the VISA pattern then it is regarded as
issued by VISA). The implication of this is that the card CCV length will be challenged against the respective card issuer CCV length.
Please note that if the card number matches two or more different card patterns then the first one (in the order of its definition) will be regarded as a match.