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 388 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 2 Nov 2024, 17:56 last edited by Robert Hairgrove 11 Feb 2024, 17:59
    #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!

    J 1 Reply Last reply 2 Nov 2024, 18:04
    0
    • R Robert Hairgrove
      2 Nov 2024, 17:56

      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!

      J Offline
      J Offline
      JonB
      wrote on 2 Nov 2024, 18:04 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 2 Nov 2024, 19:13
      1
      • J JonB
        2 Nov 2024, 18:04

        @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 2 Nov 2024, 19:13 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?

        P 1 Reply Last reply 2 Nov 2024, 19:25
        0
        • R Robert Hairgrove
          2 Nov 2024, 19:13

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

          P Offline
          P Offline
          Pl45m4
          wrote on 2 Nov 2024, 19:25 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 3 Nov 2024, 02:37 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 3 Nov 2024, 02:37

            1/5

            2 Nov 2024, 17:56

            • Login

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