Xcode 6 不再识别 \1、\2、\# 模式?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26636170/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode 6 doesn't recognize \1, \2, \# patterns anymore?
提问by Craig Gidney
In Xcode 5 I could do search-and-replaces like this:
在 Xcode 5 中,我可以像这样进行搜索和替换:
(regex)
find: \[([a-zA-Z]+) ([a-zA-Z]+)\]
replace: (regex)
find: \[([a-zA-Z]+) ([a-zA-Z]+)\]
replace: ##代码##.
.
In order to switch from syntax like [ble bla]
to ble.bla
. But when I do these sorts of searches in Xcode 6, I now turn [ble bla]
into 0.1
.
为了从像这样的语法切换[ble bla]
到ble.bla
. 但是当我在 Xcode 6 中进行这些类型的搜索时,我现在变成[ble bla]
了0.1
.
How do I use groups from the find as part of the replace?
如何使用查找中的组作为替换的一部分?
回答by Craig Gidney
Use $#
instead of \#
to refer to the groups.
使用$#
而不是\#
指代组。