Raffael
Raffael

Reputation: 20045

using '$' in the replacing text / escaping it (RegEx-mode)

my question is not about RegEx in general but about PhpStorm's search-replace-functionality with RegEx switched on.

I use PhpStorm and I want to use the dollar-sign in the replacing text.

But when I do that using RegEx mode then $ becomes the special char for identifying back references.

So I have to escape it.

But neither \$ nor $$ is accepted by PhpStorm.

How do I escape $ in RegEx-mode?

Upvotes: 15

Views: 4890

Answers (1)

Raffael
Raffael

Reputation: 20045

you have to use \\$ for the replacing text.

searching for $ is done with \$.

Upvotes: 30

Related Questions