Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Regular
Expressions
101
Regular
Expressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
(\D*)(\d)(?:(\n|$)|(\D*)(\d)((?:\n|$)?))
/
gm
Test String
New
012df3g4h5j6 78 012df3g4h5j6 7 012 3 45 6 78 012 3 45 6 012345678 01234567 01234567 012df3g4h5gh8
Substitution
Processing...
\2\5 \3\6