Are you needing pattern for only specific credit card? Each card type/issuing network will have different spacing pattern and IIN range (Issuer Identification Number). Though most popular pattern is 16 char length 4-4-4-4
Ex:
Visa, length 13-19, IIN Range always starts with 4, pattern 4-4-4-4 (pattern not known for 13-15 & 17-19 digit card)
Amex, length 15, IIN Range 34, 37, pattern 4-6-5
etc.