[英]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.当您使用
\\$
,使用的是文字$
,而不是实际的反向引用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.