Aqua 2024.3 Help

Regex search and replace inspections

You can use regular expressions to create your own search and replace inspections. These inspections can be especially useful to highlight style-based or formatting-based problems.

Access regex inspections

  1. Press Ctrl+Alt+S to open settings and then select Editor | Inspections.

  2. From the options on the right, click the Add icon.

  3. Select Add RegExp Search Inspection from the list and you’ll be directed to a dialog where you can set up your new inspection.

    Add RegExp Search Inspection
  4. Select the language, use hints on the left to build a regexp, and designate the required replacement for the selected pieces of code. You can also configure the way you want the IDE to highlight them in the project.

    Search RegExp
  5. In the editor, press Alt+Enter to invoke the inspection.

    Replace with regex result
Last modified: 11 February 2024