MetaEditor HelpDeveloping programsFind and replace

Find and replace

The MetaEditor search system allows you to quickly find necessary elements in a program text. All MetaEditor search commands are located in the Search menu:

  • Find Find... – open the search window. The same action is performed by pressing Ctrl+F.
  • Find Next Find Next – find the next item matching a search query. The same action is performed by pressing F3.
  • Find Previous Find Previous – find the previous item matching a search query. The same action is performed by pressing Shift+F3.
  • Replace Replace... – open a window to replace the found text. The same action is performed by pressing Ctrl+H.
  • Find in Files Find in Files... – open the search window by different files. The same action is performed by pressing Ctrl+Shift+F.
  • Go to Line Go to Line... – go to a line with a specified number.

Replace

The find/replace window features the following parameters and commands:

  • Find what – field to enter a search word or phrase.
  • Replace with – field to enter a word or phrase that is to replace detected elements.
  • Match case – enable/disable case sensitivity when executing the search query.
  • Match whole word only – search by a particular word form: only words or phrases that exactly match the search query are found.
  • Extended with \r \n \t – enable extended search with partial regular expression support. Use \r, \n, \t to specify line feed and tab characters in search requests.
  • Backward direction – enable search up from the current cursor position.
  • In selection – enable/disable search and replacement only in a selected text fragment.
  • #include files – add the files, included into the current file via #include, to Search and Replace. The option enables faster operations with projects consisting of multiple files. For example, to replace a text in all files, you will not need to specify their directories manually, while the editor can automatically find them through the #include directives.
  • Find Next – move to the next found element. The same action is performed by pressing F3.
  • Replace – replace a detected element.
  • Replace All – replace all detected elements.

Search and Replace useful functions:

  • If you select a text in the file and bring up the search box, the text will be automatically substituted in the "Find" field. If no text is selected, a text from the clipboard will be pasted in the "Find" field. If the clipboard is empty, the focus in the search box will be set to the "Find" field.
  • A similar behavior is implemented for the replace window: the selected text is inserted in the search field, and the cursor is moved to the "Replace with" field. Thus, you can immediately enter the required new text.
  • Search and replace results are shown in the log. If the Toolbox window is enabled, the Journal tab will be automatically selected in it.

Find in Files #

This type of search allows you to find code elements in multiple files at once, rather than in the current window only. Click Find in Files Find in Files... in the Search menu or press Ctrl+Shift+F.

Find in Files

The Find In Files window features the following parameters and commands:

  • Find what – field to enter a search word or phrase.
  • Replace with – field to enter a word or phrase that is to replace detected elements.
  • Filter – files the search is performed in. You can specify names of specific files separated by semicolons or file masks using the "*" symbol. For example, *.mq5 means searching all files with MQ5 extension.
  • Folder – folder the search is performed in. To select a folder, click Overview. For convenience, you can use the %terminal% macro instead of the full path to the platform data directory. For example, %terminal%\MQL5\Experts.
  • Look in subfolders – enable/disable search in all subfolders of a specified folder.
  • Match case – enable/disable case sensitivity when executing the search query.
  • Match whole word only – search by a particular word form: only words or phrases that exactly match the search query are found.
  • Extended with \r \n \t – enable extended search with partial regular expression support. Use \r, \n, \t to specify line feed and tab characters in search requests.
  • Find All – perform a search on request.
  • Replace in Files – replace found elements in all files.

Results of searching in files are displayed on the Search tab of the Toolbox window. If the search request yields no results, the appropriate message is displayed on the Search tab.

Search in the Community #

MetaEditor features the smart and high-performance search throughout MQL5.community – community of traders and MQL4/MQL5 developers. The site contains a lot of useful information: documentation, forum, blogs of traders and analysts, articles related to programming and platform use. The community provides access to the huge source code database and the application storefor the platform.

In addition to MQL5.community, the search includes other popular platforms, such as GitHub, MSDN and Stack Overflow.

Search in the MQL5.community

Search results from external resources appear in the toolbox window:

GitHub and MSDN search results

Furthermore, you can immediately download source files from GitHub. Files are downloaded into a separate subdirectory of the Projects folder, named in accordance with the GitHub project name.