Qt Creator: Find and Replace using regular expressions
-
After Qt Creator creates empty implementations for member functions declared in a header file, I would like to replace, for example:
ExceptionHandler::ExceptionHandler() { }
to result in this:
ExceptionHandler::ExceptionHandler() { // TO DO }
Unfortunately, I cannot find the correct regular expression to work which finds the
"{ }"
(with embedded newlines). I have tried"\{\n\n\}"
and"\{\n\n\}\n"
, for example, and have the option "Use regular expressions" checked.I also tried
"^\{\n\n\}$"
and"^\{\n\n\}\n$"
without success.Doubling the backslashes doesn't help, either.
Thanks for any help!
-
@Robert-Hairgrove
I think you will find Creator does not allow searching for newlines/multiline. It was requested but never implemented in 2010 :) Like many editors and tools it searches line by line. It can surprisingly insert newlines into the replacement, but not in the find string. -
@JonB Thanks! I wonder what other "features" of regex are broken here? Searching for newlines are really basic functionality. Geany, for example, does this perfectly ... it is also based on Scintilla, as is the editor in Qt Creator.
Maybe someone knows of a work-around?
-
@Robert-Hairgrove said in Qt Creator: Find and Replace using regular expressions:
I wonder what other "features" of regex are broken here?
I'm not sure if this is related to regex.
Notepad++ for instance has different options for "normal" text search, regex and an option to convert and search backslash-n's, r's and so on...
So you can find every place where enter was pressed (like CR LF or\r\n
) very easily.But yeah, you are right... It should already be included in an IDE / TextEditor like QtCreator :(
-
Have added
Geany
as an external tool for this. -