Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
(\d{4})(?=\d)
/
gm

Description

You can use this pattern to mask your raw credit card's number, like this one:

1111222233334444 => 1111-2222-3333-4444

Submitted by anonymous - 4 years ago