Regex Cheatsheet - Regular Expression Quick Reference

Quick reference for regular expression patterns. Character classes, quantifiers, anchors, and common patterns.

Share
Back to Regex Cheatsheet

Credit Card Pattern

Common Pattern

Match credit card number (16 digits, optional separators)

Pattern

\d{4}[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}

Examples

1234-5678-9012-3456

Card with hyphens

Matches: 1234-5678-9012-3456

1234567890123456

Plain digit card

Matches: 1234567890123456

Related Patterns

Related Tools

More Text Tools