Can a regex match valid card numbers?
Summary
The post explores whether a single regex can validate Luhn-check card numbers by converting a DFA into a regex; demonstrates that a regex can exist but is enormous (millions of characters) and impractical; warns about relying on regex for detecting or scrubbing card data and discusses PCI DSS compliance.