User forums > Using Code::Blocks

Advanced find and replace

<< < (2/2)

oBFusCATed:
Probably you'll fail badly if you use regexps. The best option at the moment is to write a clang-tidy check and fixups. Or see if there isn't one already.

sodev:
Depends on how well you keep your if's structured :).

The following expression does work with the CodeBlocks RegExp flavor and matches the presented format, it does allow extra whitespace where possible but it does not work with additional conditions nor if the if is spread across multiple lines nor if you use fancy unicode names for your identifiers (or anything else than 7-Bit ASCII).


--- Code: ---Search: \([ \t]*if[ \t]*(\)[ \t]*![ \t]*\([a-zA-Z0-9_]+\.empty()\)[ \t]*\().*\)
Replace: \1\2 == false\3

--- End code ---

Jewest:
ended up using notepadQQ.
using find and replace "\(\!.*\)" replace with "(\1 == false)"

Navigation

[0] Message Index

[*] Previous page

Go to full version