- Replace in Files
- To display Replace in Files
- Find what
- Replace With
- Look in
- Find options
- Result options
- Замена в файлах Replace in Files
- Отображение окна «Заменить в файлах» To display Replace in Files
- Найти Find what
- Заменить на Replace With
- Искать в Look in
- Параметры поиска Find options
- Параметры результатов Result options
Replace in Files
Replace in Files allows you to search the code of a specified set of files for a string or expression, and change some or all of the matches found. The matches found and actions taken are listed in the Find Results window selected in Result options.
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, for example to General or Visual C++ settings, choose Tools > Import and Export Settings, and then choose Reset all settings.
You can use any of the following methods to display Replace in Files in the Find and Replace window.
To display Replace in Files
On the Edit menu, expand Find and Replace.
Choose Replace in Files.
If the Find and Replace window is already open, on the toolbar, choose Replace in Files.
Find what
To search for a new text string or expression, specify it in the box. To search for any of the 20 strings that you searched for most recently, open the drop-down list and choose the string. Choose the adjacent Expression Builder button if you want to use one or more regular expressions in your search string. For more information, see Use regular expressions in Visual Studio.
The Expression Builder button will only be enabled if you have selected Use Regular Expressions under Find options.
Replace With
To replace instances of the string in the Find what box with another string, enter the replacement string in the Replace With box. To delete instances of the string in the Find what box, leave this field blank. Open the list to display the 20 strings for which you searched most recently. Choose the adjacent Expression Builder button if you want to use one or more regular expressions in your replacement string. For more information, see Use regular expressions in Visual Studio.
Look in
The option chosen from the Look in drop-down list determines whether Replace in Files searches only in currently active files or searches all files stored within certain folders. Select a search scope from the list, type a folder path, or click the Browse (. ) button to display the Choose Search Folders dialog box and choose a set of folders to search. You can also type a path directly into the Look in box.
If the Look in option selected causes you to search a file that you have checked out from source code control, only the version of that file which has been downloaded to your local machine is searched.
Find options
You can expand or collapse the Find options section. The following options can be selected or cleared:
Match case
When selected, the Find Results windows will only display instances of the Find what string that are matched both by content and by case. For example, a search for «MyObject» with Match case selected will return «MyObject» but not «myobject» or «MYOBJECT.»
Match whole word
When selected, the Find Results windows will only display instances of the Find what string that are matched in complete words. For example, a search for «MyObject» will return «MyObject» but not «CMyObject» or «MyObjectC.»
Use Regular Expressions
When this check box is selected, you can use special notations to define patterns of text in the Find what or Replace with text boxes. For a list of these notations, see Use regular expressions in Visual Studio.
Look at these file types
This list indicates the types of files to search through in the Look in directories. If this field is left blank, all of the files in the Look in directories will be searched. Select any item in the list to enter a preconfigured search string that will find files of those particular types.
Result options
You can expand or collapse the Result options section. The following options can be selected or cleared:
Find Results 1 window
When selected, the results of the current search will replace the content of the Find Results 1 window. This window opens automatically to display your search results. To open this window manually, select Other Windows from the View menu and choose Find Results 1.
Find Results 2 window
When selected, the results of the current search will replace the content of the Find Results 2 window. This window opens automatically to display your search results. To open this window manually, select Other Windows from the View menu and choose Find Results 2.
Display file names only
When this check box is selected, the Find Results windows list the full names and paths for all files that contain the search string. However, the results don’t include the line of code where the string appears. This check box is available for Find in Files only.
Keep modified files open after Replace All
When selected, leaves open all files in which replacements have been made, so you can undo or save the changes. Memory constraints might limit the number of files that can remain open after a replace operation.
You can use Undo only on files that remain open for editing. If this option is not selected, files that were not already open for editing will remain closed, and no Undo option will be available in those files.
Замена в файлах Replace in Files
Функция Заменить в файлах позволяет осуществлять поиск строки или выражения в заданном наборе файлов и заменять все или некоторые из найденных совпадений. Replace in Files allows you to search the code of a specified set of files for a string or expression, and change some or all of the matches found. Найденные совпадения и предпринятые действия перечисляются в окне Результаты поиска, выбранном в разделе Параметры результатов. The matches found and actions taken are listed in the Find Results window selected in Result options.
Отображаемые диалоговые окна и команды меню могут отличаться от описанных в справке в зависимости от текущих параметров или выпуска. The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. Чтобы изменить параметры, например на Общие или Visual C++, выберите Сервис > Импорт и экспорт параметров, а затем щелкните Сбросить все параметры. To change your settings, for example to General or Visual C++ settings, choose Tools > Import and Export Settings, and then choose Reset all settings.
Для отображения функции Заменить в файлах в окне Поиск и замена можно использовать любой из следующих методов. You can use any of the following methods to display Replace in Files in the Find and Replace window.
Отображение окна «Заменить в файлах» To display Replace in Files
В меню Правка разверните узел Поиск и замена. On the Edit menu, expand Find and Replace.
Выберите Заменить в файлах. Choose Replace in Files.
Если окно Поиск и замена уже открыто, на панели инструментов выберите Заменить в файлах. If the Find and Replace window is already open, on the toolbar, choose Replace in Files.
Найти Find what
Чтобы найти новую текстовую строку или выражение, введите их в поле. To search for a new text string or expression, specify it in the box. Для поиска любой из 20 строк, которые вы искали недавно, откройте раскрывающийся список и выберите нужную строку. To search for any of the 20 strings that you searched for most recently, open the drop-down list and choose the string. Нажмите расположенную рядом кнопку Построитель выражений, чтобы использовать в строке поиска одно или несколько регулярных выражений. Choose the adjacent Expression Builder button if you want to use one or more regular expressions in your search string. Дополнительные сведения см. в статье Использование регулярных выражений в Visual Studio. For more information, see Use regular expressions in Visual Studio.
Кнопка Построитель выражений будет включена, только если вы выбрали Использовать регулярные выражения в области Параметры поиска. The Expression Builder button will only be enabled if you have selected Use Regular Expressions under Find options.
Заменить на Replace With
Чтобы заменить экземпляры строки в поле Образец другой строкой, введите заменяющую строку в поле Заменить на. To replace instances of the string in the Find what box with another string, enter the replacement string in the Replace With box. Чтобы удалить экземпляры строки в поле Образец, оставьте это поле пустым. To delete instances of the string in the Find what box, leave this field blank. Откройте список для отображения последних 20 строк, поиск которых выполнялся недавно. Open the list to display the 20 strings for which you searched most recently. Нажмите расположенную рядом кнопку Построитель выражений, чтобы использовать в заменяющей строке одно или несколько регулярных выражений. Choose the adjacent Expression Builder button if you want to use one or more regular expressions in your replacement string. Дополнительные сведения см. в статье Использование регулярных выражений в Visual Studio. For more information, see Use regular expressions in Visual Studio.
Искать в Look in
Параметр, выбранный в раскрывающемся списке Искать в , определяет, будет ли функция Замена в файлах осуществлять поиск только в файлах, активных в текущий момент, или во всех файлах, хранимых в определенных папках. The option chosen from the Look in drop-down list determines whether Replace in Files searches only in currently active files or searches all files stored within certain folders. Выберите область поиска в списке или нажмите кнопку Обзор (. ), чтобы открыть диалоговое окно Выбор папок поиска и выбрать набор папок, в которых будет выполняться поиск. Select a search scope from the list, type a folder path, or click the Browse (. ) button to display the Choose Search Folders dialog box and choose a set of folders to search. Можно также ввести путь непосредственно в поле Область поиска. You can also type a path directly into the Look in box.
Если после выбора варианта Область поиска начинается поиск в файле, извлеченном из системы управления исходным кодом, поиск производится только в версии файла, скачанной на локальный компьютер. If the Look in option selected causes you to search a file that you have checked out from source code control, only the version of that file which has been downloaded to your local machine is searched.
Параметры поиска Find options
Вы можете развернуть или свернуть раздел Параметры поиска. You can expand or collapse the Find options section. Можно установить или снять следующие флажки. The following options can be selected or cleared:
Учитывать регистр Match case
Если этот флажок установлен, в окне Результаты поиска будут отображаться только те экземпляры строки Образец, которые соответствуют заданному содержанию и регистру. When selected, the Find Results windows will only display instances of the Find what string that are matched both by content and by case. Например, поиск строки MyObject с учетом регистра будет возвращать MyObject, но не myobject или MYOBJECT. For example, a search for «MyObject» with Match case selected will return «MyObject» but not «myobject» or «MYOBJECT.»
Слово целиком Match whole word
Если этот флажок установлен, в окне Результаты поиска будут отображаться только те экземпляры строки Образец, которые точно соответствуют введенным словам. When selected, the Find Results windows will only display instances of the Find what string that are matched in complete words. Например, поиск строки MyObject будет возвращать MyObject, но не CMyObject или MyObjectC. For example, a search for «MyObject» will return «MyObject» but not «CMyObject» or «MyObjectC.»
Использование регулярных выражений Use Regular Expressions
Если этот флажок установлен, вы можете использовать специальные обозначения, чтобы определить шаблоны текста в текстовых полях Образец или Заменить на. When this check box is selected, you can use special notations to define patterns of text in the Find what or Replace with text boxes. Список этих обозначений см. в статье Использование регулярных выражений в Visual Studio. For a list of these notations, see Use regular expressions in Visual Studio.
Искать в файлах указанных типов Look at these file types
Этот список указывает типы файлов для поиска в каталогах Область поиска. This list indicates the types of files to search through in the Look in directories. Если оставить это поле пустым, поиск будет выполняться во всех файлах в каталогах Область поиска. If this field is left blank, all of the files in the Look in directories will be searched. Выберите любой элемент в списке, чтобы ввести заранее заданную строку для поиска указанных типов файлов. Select any item in the list to enter a preconfigured search string that will find files of those particular types.
Параметры результатов Result options
Вы можете развернуть или свернуть раздел Параметры результатов. You can expand or collapse the Result options section. Можно установить или снять следующие флажки. The following options can be selected or cleared:
Окно Результаты поиска 1 Find Results 1 window
Если выбран этот параметр, результаты текущего поиска заменяют содержимое окна Результаты поиска 1. When selected, the results of the current search will replace the content of the Find Results 1 window. Это окно открывается автоматически и отображает результаты поиска. This window opens automatically to display your search results. Чтобы открыть окно вручную, выберите Другие окна в меню Вид и выберите Результаты поиска 1. To open this window manually, select Other Windows from the View menu and choose Find Results 1.
Окно Результаты поиска 2 Find Results 2 window
Если выбран этот параметр, результаты текущего поиска заменяют содержимое окна Результаты поиска 2. When selected, the results of the current search will replace the content of the Find Results 2 window. Это окно открывается автоматически и отображает результаты поиска. This window opens automatically to display your search results. Чтобы открыть окно вручную, выберите Другие окна в меню Вид и выберите Результаты поиска 2. To open this window manually, select Other Windows from the View menu and choose Find Results 2.
Отображать только имена файлов Display file names only
Если этот флажок установлен, то в окнах Результаты поиска выводится список полных имен и путей для всех файлов, содержащих строку поиска. When this check box is selected, the Find Results windows list the full names and paths for all files that contain the search string. Но результаты не включают строку кода, в которой содержится заданная строка. However, the results don’t include the line of code where the string appears. Этот флажок доступен только для функции Найти в файлах. This check box is available for Find in Files only.
Оставить измененные файлы открытыми после выполнения команды «Заменить все» Keep modified files open after Replace All
Если этот флажок установлен, все файлы, в которых были произведены замены, останутся открытыми, так что изменения можно будет сохранить или отменить. When selected, leaves open all files in which replacements have been made, so you can undo or save the changes. Объем доступной памяти может ограничить число файлов, которые останутся открытыми после операции замены. Memory constraints might limit the number of files that can remain open after a replace operation.
Команда Откат может использоваться только для файлов, которые остались открытыми для редактирования. You can use Undo only on files that remain open for editing. Если этот параметр не установлен, файлы, которые не были до этого открыты для редактирования, останутся закрытыми, а команда Откат не будет для них доступна. If this option is not selected, files that were not already open for editing will remain closed, and no Undo option will be available in those files.