Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
\b(?:\d{4}[ -]?){3}(?=\d{4}\b)
/
gm
Input 1
1
New
Hi here is my card number its visa 4242 4242 4242 4242 Hi here is my card number its visa 4242424242424242 Hi here is my card number its visa 4242-4242-4242-4242
Extraction
Hi here is my card number its visa 4242 4242 4242 4242 Hi here is my card number its visa 4242424242424242 Hi here is my card number its visa 4242-4242-4242-4242