Bin e padrões para validação de cartão de crédito.
| Bandeira | Começa com | Máximo de número | Máximo de número cvc |
|---|---|---|---|
| Visa | 4 | 13,16 | 3 |
| Mastercard | 5 | 16 | 3 |
| #!/usr/bin/env node | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const os = require('os'); | |
| /** | |
| * Writes bash env variables to a .env.js file | |
| */ | |
| // const _bashEnvToEnvFileJs = () => { | |
| // /** Destination Env file path */ |
| -- Retrieve descendants | |
| -- ==================== | |
| -- retrieve descendants of #4 | |
| SELECT c.* | |
| FROM Comments AS c | |
| JOIN TreePaths AS t ON c.comment_id = t.descendant | |
| WHERE t.ancestor = 4; | |
| -- Retrieve ancestors |
| <?php | |
| // Função para checar número de telefone | |
| function phone_check($phone) | |
| { | |
| $exp_regular = '/^\(\d{2}\)\s[2-5]\d{3}\-\d{4}$/'; | |
| $ret = preg_match($exp_regular, $phone); | |
| if($ret === 1) | |
| { | |
| echo 'Número de telefone válido'; |
| <?php | |
| // function to check dates | |
| public function date_check($date) | |
| { | |
| $exp_regular = '/^(\d{2})[\/](\d{2})[\/](\d{4})/'; | |
| $ret = preg_match($exp_regular, $date, $matches); | |
| if($ret === 1) | |
| { | |
| $dd = $matches[1]; |
| <?php | |
| // Função para checar número de telefone | |
| function phone_check($phone) | |
| { | |
| $exp_regular = '/^(\(11\) (9\d{4})-\d{4})|((\(1[2-9]{1}\)|\([2-9]{1}\d{1}\)) [5-9]\d{3}-\d{4})$/'; | |
| $ret = preg_match($exp_regular, $phone); | |
| if($ret === 1) | |
| { |
| -- Retrieve descendants | |
| -- ==================== | |
| -- retrieve descendants of #4 | |
| SELECT c.* | |
| FROM Comments AS c | |
| JOIN TreePaths AS t ON c.comment_id = t.descendant | |
| WHERE t.ancestor = 4; | |
| -- Retrieve ancestors |