更新时间:2023-02-17 23:01:29
\1
引用了第一个 捕获组,表示搜索正则表达式中的第一组括号.您的正则表达式中没有,因此 \1
没有任何可参考的内容.
\1
references the contents of the first capturing group, which means the first set of parentheses in your search regex. There isn't one in your regex, so \1
has nothing to refer to.
如果要引用整个匹配项,请使用 \0
,或者在正则表达式的相关部分周围添加括号.
Use \0
if you want to reference the entire match, or add parentheses around the relevant part of the regex.
find: name[A-Z_0-9]+
replace: \0_SUFFIX
会将nameABC
改为nameABC_SUFFIX
.
使用捕获组,您可以执行以下操作
Using capturing groups, you can do things like
find: name([A-Z_0-9]+)
replace: \1_SUFFIX
它将用 ABC_SUFFIX
替换 nameABC
.