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)):

  1. Ensure that any work you have done is committed to version control, as the changes cannot be undone.
  2. Press Ctrl+Shift+F to bring up the Advanced Find form.
  3. Change the scope to whatever is appropriate for your search.
  4. Under the Search for text field, select the Use regular expressions check box.
  5. Enter the following text in the Search for text field:
    if \((.*) == (.*)\)
  6. Press Search & Replace to see a list of search results.
  7. In the Replace with text field, enter the following text:
    if (\1.strictlyEquals(\2))
  8. Press Replace to replace all instances of the text.

For more information, see Advanced Search.

© 2024 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.