match if the string is a credit card
Credit card number is the card unique identifier found on payment cards.
This expression can be used to detect or verify credit card numbers:
If you want to use regex just to know the card brand for visual use (display Visa logo or label), that is fine.
But if your code logic depends on it, then don't use regex, and use a 3rd party plugin/library instead (read more about it here).