Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator: Find and Replace using regular expressions
Forum Updated to NodeBB v4.3 + New Features

Qt Creator: Find and Replace using regular expressions

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
5 Posts 3 Posters 432 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Robert Hairgrove
    wrote on last edited by Robert Hairgrove
    #1

    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!

    JonBJ 1 Reply Last reply
    0
    • R Robert Hairgrove

      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!

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @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.

      R 1 Reply Last reply
      1
      • JonBJ JonB

        @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.

        R Offline
        R Offline
        Robert Hairgrove
        wrote on last edited by
        #3

        @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?

        Pl45m4P 1 Reply Last reply
        0
        • R Robert Hairgrove

          @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?

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #4

          @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.

          findBackN.png

          But yeah, you are right... It should already be included in an IDE / TextEditor like QtCreator :(


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Robert Hairgrove
            wrote on last edited by
            #5

            Have added Geany as an external tool for this.

            1 Reply Last reply
            0
            • R Robert Hairgrove has marked this topic as solved on

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved