Find and Replace using patterns in Xcode 8

2019-06-05 05:45发布

问题:

I was trying to update one of my old Xcode 7 answers that described how to do regular expression matching. However, I can't get the Textual Matching Style to work now. In Xcode 7, I could do something like this:

which gave me pattern matching like this:

But in Xcode 8 the green bubbles don't show up. I get a (\w+) but that doesn't match anything in the Textual style anymore. And when I am in The Regular Expression Matching Style, I don't have all the nice Insert Pattern hints anymore.

What am I doing wrong?

Note: I'm not asking for the regex answer. I'm asking how to get the Insert Pattern hints to work.

回答1:

You switched your find options Matching Style from Text to Regular Expression. To revert this, simply click on the magnifying glass next to the search field, select Edit find options... and set the Matching Style back to text.