Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
263 views
in Technique[技术] by (71.8m points)

regex - Xcode 6 doesn't recognize 1, 2, # patterns anymore?

In Xcode 5 I could do search-and-replaces like this:

(regex)
   find: [([a-zA-Z]+) ([a-zA-Z]+)]
replace: .1

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.

How do I use groups from the find as part of the replace?

question from:https://stackoverflow.com/questions/26636170/xcode-6-doesnt-recognize-1-2-patterns-anymore

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use $# instead of # to refer to the groups.

(regex)
   find: [([a-zA-Z]+) ([a-zA-Z]+)]
replace: $0.$1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...