Skip to content

Instantly share code, notes, and snippets.

@kayac-chang
Created May 22, 2022 12:19
Show Gist options
  • Save kayac-chang/65be419cb2b1c81d48b3fd7d8852c907 to your computer and use it in GitHub Desktop.
Save kayac-chang/65be419cb2b1c81d48b3fd7d8852c907 to your computer and use it in GitHub Desktop.
check_credit_card
def is_amax(card_number):
return re.search(r"(?=\b.{15}\b)^(34|37)", card_number)
def is_master_card(card_number):
return re.search(r"(?=\b.{16}\b)^5[1..5]", card_number)
def is_visa(card_number):
return re.search(r"(?=\b.{13,16}\b)^4", card_number)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment