WebStorm 2018.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.

Create a search template

  1. On the main menu, choose Edit | Find | Search Structurally.

  2. In the Search template text area, type code for your template and click Save Template.

  3. In the dialog that opens, specify the name of your template and click OK.

  4. If you need to configure the template variables, click the Edit variables button. Edit Variables dialog 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.

Use the existing templates as prototypes

  1. On the main menu, choose Edit | Find | Search Structurally.

  2. In the dialog that opens, click Existing Templates.

  3. In the Existing Templates dialog, select a template you want to use as a prototype and click OK.

  4. In the Search template text area, if you need, adjust the code. Click Edit Variables to apply constraints to your template.

  5. Click Save Template, specify a name for your template and click OK.

Last modified: 19 November 2018

See Also