Skip to content

Instantly share code, notes, and snippets.

View zakcroft's full-sized avatar

Zak Croft zakcroft

View GitHub Profile
@zakcroft
zakcroft / gist:5c045ebbfa0d3e4aacc4d21fe0196ffa
Last active January 14, 2023 09:36
JS credit card formatter
//JS credit card formatter for onChange handler
"97181237removed12891237192random3712".replace(/[\D]/g, '').match(/.{1,4}/g)?.join(' ').substring(0, 19) || '';
// '9718 1237 1289 1237'