> ## Content Index
> Fetch the complete content index at: https://www.smallstepsystems.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# QtCreator - Search & Replace with Captured Texts
- URL: https://www.smallstepsystems.com/qtcreator-search-replace-with-captured-texts/
- Published: 2015-02-08T18:35:11.000Z
- Updated: 2026-01-25T16:22:36.000Z
- Author: Burkhard Stubert

I wanted to replace many occurrences of

`g_theme.themeDisplay(100, 80, 65)`

by

`g_theme.thSz([100, 80, 65])`

in many QML files. The values of the three integer arguments varied from occurrence to occurrence. What I hoped for was that QtCreator's search & replace function for regular expressions would support captured texts - the three arguments.

I entered

`g_theme.themeDisplay(([^)]+))`

in the field "Search for" of QtCreator's search function, ticked "Use regular expressions", and hit "Search & replace". In the entry field for the replacement string, I entered

`g_theme.thSz([\1])`

and hit the "Replace" button. And - all was magically done!

The regular expression of the search term captures the text inside the parentheses of the function call with the subexpression `([^)]+)`. The unescaped parentheses mark the text to be captured. The captured text is just everything that does not match a closing parenthesis - that is everything between the original opening and closing parenthesis.

The replace term accesses this captured text with `\1`. It's all exactly as you would expect it from the QRegExp class.