Credit Card Number

Published on Tue Mar 01 2022

Validates Credit Card Numbers of different type. Supports Visa, MasterCard, American Express, Diners Club, Discover and JCB Taken from http://www.regular-expressions.info/creditcard.html If you want to support only a particular type, customise it based on following. ^(?:4[0-9]{12}(?:[0-9]{3})? # Visa | 5[1-5][0-9]{14} # MasterCard | 3[47][0-9]{13} # American Express | 3(?:0[0-5]|[68][0-9])[0-9]{11} # Diners Club | 6(?:011|5[0-9]{2})[0-9]{12} # Discover | (?:2131|1800|35\d{3})\d{11} # JCB )$

Additional matching regexes for
Credit Card Number

Credit Card Number

Validates Credit Card Numbers of different type. Supports Visa, MasterCard, American Express, Diners Club, Discover and JCB Taken from http://www.regular-expressions.info/creditcard.html If you want to support only a particular type, customise it based on following. ^(?:4[0-9]{12}(?:[0-9]{3})? # Visa | 5[1-5][0-9]{14} # MasterCard | 3[47][0-9]{13} # American Express | 3(?:0[0-5]|[68][0-9])[0-9]{11} # Diners Club | 6(?:011|5[0-9]{2})[0-9]{12} # Discover | (?:2131|1800|35\d{3})\d{11} # JCB )$

Credit Card (Master/Visa)

Searches for credit card numbers from MasterCard or visa

North American Phone Number

Validate **North American** **phone numbers** with capture groups for the **Area Code**, **Exchange Code**, **Line Number**, and **Extension**.

Credit Card Validation - MasterCard, Visa, Amex, Discover

MasterCard - ^5[1-5]\d+ Visa - ^4\d+ Amex - ^3[47]\d+ Discover - 6011|65|64...

Mobile Number Regex

The following regex validates international mobile numbers

Valid Telephone Number

This regex validates varying types of telephone numbers.

Youtube ID matcher

Credit: https://gist.github.com/FinalAngel/1876898

HTTP url parser

Parses a URL to the different parts

credit card

Based on http://www.regular-expressions.info/creditcard.html This example includes test strings. This only validates the pattern, and not whether the credit card number passes a checksum validation. See the Luhn algorithm for details https://en.wikipedia.org/wiki/Luhn_algorithm For an implementation in Lasso, see https://github.com/stevepiercy/sp_valid_creditcard

Extract port from URL

Extracts the port from different possible forms of URL