Search and replace across files using a regular expression
As an example, say you want to replace equality checks (foo == bar
) with a function (foo.equals(bar)
):
- Ensure that any work you have done is committed to version control, as the changes cannot be undone.
- Press Ctrl+Shift+F to bring up the Advanced Find form.
- Change the scope to whatever is appropriate for your search.
- Under the Search for text field, select the Use regular expressions check box.
- Enter the following text in the Search for text field:
if \((.*) == (.*)\)
- Press Search & Replace to see a list of search results.
- In the Replace with text field, enter the following text:
if (\1.strictlyEquals(\2))
- Press Replace to replace all instances of the text.
For more information, see Advanced Search.
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.