WebStorm 2017.2 Help

Creating and Editing Search Templates

You can create search and replace templates from scratch, just typing the code in the text area of the Structural Search / Replace dialog box. However, there is a collection of the predefined search templates that you can use as prototypes for your own templates. All custom templates appear in the list of existing search templates, under the node User defined.

To create a search template, follow these general steps:

  • On the main menu, choose Edit | Find | Search Structurally.
  • Do one of the following:
    • Type the code of your template in the Search template text area.
    • Click the Copy existing template button, and in the Existing Templates dialog box, select the desired template as a prototype. The source code of the selected template appears in the Search template text area, where you can change it as required.
  • If you need to configure the template variables, click the Edit variables button. Edit Variables dialog box appears.

    In the Variables column, select a variable you want to configure, and specify the constraints that will apply to this variable. See the dialog reference page for the detailed description of constraints.

    Repeat the process for the other variables, as required, apply changes and close the dialog box.

  • Click the Save Template button.
  • In the Save Template dialog, type the name of the new template, and click OK.
Last modified: 29 November 2017

See Also