简体   繁体   中英

How to replace in WebStorm/PhpStorm with regex

I want to replace

#{account_nbr}

with

{{account_nbr}}

in the find, I tried this:

\#\{()\w+\1\}

and in the replace, this:

{{\$1}}

The find seems to work but I can't get the backreference correctly.

What's wrong?

You do not need any backreferences the way you are using them.

This is the regex you can use:

\#\{(\w+)\}

Replacement should be

{{$1}}

When you use \\$ , a literal $ is used, not the actual back-reference.

Regex demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM