When You have a replace and you want to replace text with something that contains $ You get a malformed replacement string (interpreter thinks its a variable reference). The $$ doesn't work.
To use RegEx, the first argument of replace will be replaced with regex syntax, for example /regex/ . This syntax serves as a pattern where any parts of the string that match it will be replaced with the new substring. The string 3foobar4 matches the regex /\d. *\d/ , so it is replaced.
As featured in Regular Expression Syntax Reference - you can use \\$
to escape $ sign.
\ $1
if IDE from JetBrains you need type space character between slash and sign dollar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With