Credit Card Number (with a separator in between) Validation Regex

The following will validate Visa and Master card numbers that’s in the following format

^(?:4[0-9]{3}(?:-[0-9]{4}){2}-[0-9](?:[0-9]{3})?|5[1-5][0-9]{2}(?:-[0-9]{4}){3})$
4111-1111-1111-1111 (note the ‘-‘)  

Regex adapted from: http://www.regular-expressions.info/creditcard.html

Tip: Also found this super AWESOME regex testing site: https://regex101.com/#javascript