How do you use patterns in replace field?

Just upgraded to Xcode 9. I must be missing something. The Find field has a + button that can insert a pattern. So far, so good. But when I want to pull that pattern into my replace, can't figure out how to do it. There is no + button on the replace field. If I put the cursor into the Find field and press the + button on the Find field, the cursor jumps to the end of the Find field and places the pattern there. If I cut and paste a pattern symbol into the Replace field, it comes out as a literal string for the regex that underlies the pattern. If I use $0 in the Replace field, I get the entire match from the Find field inserted into the replacement string. If I use $1, I get nothing inserted into the replacement string.


EDIT:


As of today, I retried and $1 in the replace string did act like a capture of the wildcard Any in my search string. It was more friendly the old way, but at least I can use it now.

It works for me, at least in a simple case. For the find pattern (with "regular expression" chosen from the popup), I entered:


(view)(did)(load)


and for the replace pattern:


$3$2$1


then it replaced "viewDidLoad" with "LoadDidview", as expected. The patterns on the "+" popup menu are things to find, and so aren't usable in the replace field.


AFAICT, using any of these patterns prevents an explicit regex search, regardless of the "regular expression" setting. Which is a bit weird. It means there are effectively 3 modes:


1. Literal text.


2. Literal text with patterns.


3. Regular expression.


There is apparently no "regular expression with patterns" mode.

Yes, the regular expression functionality works great. No problems there. My issue is when using the other searches.


When I use "contains", I can insert patterns into the Find field. I cannot insert them into the Replace field. This could be done in Xcode 8 and was useful and often much easier than regular expressions for straightforward tasks.

What did they mean in the replace field? They are, after all, match patterns.


Anyway, if this is a regression from Xcode 8, you should submit a bug report. I think it's one of the small touches that Xcode 9 "lost" in the editor rewrite, either being overlooked or jettisoned from time. With luck, Apple will restore the functionality eventually.

In Xcode 8, if you put a pattern into a Find and also in the replace, it acted like a capture group in a regex. As I said, I cannot figure out how to put a pattern into Xcode 9 Replace field. May be a bug or may be my own failure to recognize how to use it. I will give this post a few more days to see if someone can enlighten me before I post it as a bug.

How do you use patterns in replace field?
 
 
Q