Regex search and replace inspections
Last modified: 11 February 2024You 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
Press to open the IDE settings and then select Editor | Inspections.
From the options on the right, click
.
Select Add RegExp Search Inspection from the list and you’ll be directed to a dialog where you can set up your new inspection.
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.
In the editor, press to invoke the inspection.