Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
(ABC[#:*$]+(?:\w+[#:*$]+){2}|DEF[#:*$]+(?:\w+[#:*$]+){3})([^#:*$]+)(.+)
/
g
Input 1
1
New
ABC#12#3#LINE1####1234678985$ DEF#XY#Z:1234:1234561230$ ABC#12#3#LINE TWO####1234678985$ DEF#XY#Z:1234:4564561230$ ABC#12#3#3RD LINE####1234678985$ DEF#XY#Z*1234:7894561230$
Substitution
\1 + replacement + \3