[英]NotePad++ Regular Expression and Replace
How can i replace 我该如何更换
$lang['abc'] with lang('abc')
and 和
{$lang['abc']} with ".lang('abc')."
including quotes. 包括引号。
Where i am stuck is how RegExp can save 'abc'
to be used in replaced text 我遇到的问题是RegExp如何保存
'abc'
以用于替换文本
First one (tested in N++): 第一个 (在N ++中测试):
Search: \\$lang\\['(abc)'\\]
搜索:
\\$lang\\['(abc)'\\]
Replace: lang\\('$1'\\)
替换:
lang\\('$1'\\)
Second one (also tested in N++): 第二个 (也在N ++中测试):
Search: \\{\\$lang\\['(abc)'\\]\\}
搜索:
\\{\\$lang\\['(abc)'\\]\\}
Replace: ".lang\\('$1'\\)."
替换为:
".lang\\('$1'\\)."
The back reference mentioned by devnull is the content of the (abc) parentheses. devnull提到的反向引用是(abc)括号的内容。 The parentheses capture abc into Group 1. That content is referred to in the replacement as "$1".
括号将abc捕获到组1中。该内容在替换中称为“ $ 1”。 You may like to read all about regex capture .
您可能想阅读有关正则表达式捕获的全部内容 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.