Reputation: 9915
I would like to replace
import Quick
import Nimble
with
import XCTest
Is it possible to do it in Xcode find and replace or I have to use Xcode regular expressions?
I have tried: import Quick\nimport Nimble but it doesn't work as expected
Upvotes: 1
Views: 1050
Reputation: 4058
THE FAST WAY:
You can simply copy both lines dragging with the mouse and the paste them on find textfield.
THE COOL LEEMUR'S WAY:
But also there is a great way to find expressions:
Press CMD + f
A find field will appear on the top of the editor.
Its very useful, you can make something similar to regular expressions, mixing literal text with patterns
You can try to find the expression just in the current file writing it in the top find field. Or you can try to find the expression in the whole project using the Find Navigation tab on the left. As you will see the expression will appear there also.
Moreover if you want you can use an actual regular expression to find something if you press in the word "Contains" at the left of the "+" sign. It will show a list where you can select the option "Regular Expression"
If you want to find text select "Find" at the left of the editor. If you want to replace it, select "Replace" and a new field will appear below.
You can replace the text with another pattern, using some of the words that you used to find the text. If you double clic on "Word1" at the find field it will appear at the replace field.
In this example I'm changing the order of two words around MyText
Upvotes: 2
Reputation: 3885
I don't know how you tried and failed. But I tried and it worked. Procedures as bellow:
Shift+Option+CMD+F
to open Find navigator
in Xcode, then CMD+V
to paste the multiline text.Upvotes: 1
Reputation: 10172
You can find for multiline text and replace it (cmd+opt+f) with new text. make sure to copy and paste multiline text as it is written on the Xcode file.
Upvotes: 1