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
/
(^|[^'$])\$x([^']?)
/
gm
Input 1
1
New
$x books 1.Read $x books. 2.Read $$x is invalid. 3.Read$x books today. 4.Read books in $xminutes. 5.You selected '$x' as $x
Substitution
$1$y$2
$x books 1.Read $x books. 2.Read $$x is invalid. 3.Read$x books today. 4.Read books in $xminutes. 5.You selected '$x' as $x