Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Creator: How use find result in replace result
Forum Updated to NodeBB v4.3 + New Features

Qt Creator: How use find result in replace result

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 835 Views 1 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.
  • D Offline
    D Offline
    Deepfreeze
    wrote on last edited by
    #1

    I had the following. I would like to search my code for anything between quotes.

    So:
    @"This string"
    "value"@

    Now with a regular expression, I can find these sections. But I would like to replace them
    with:
    @TEXT("This string")
    TEXT("value")@

    So the found value should in some way be used in the replace action. How do I type this
    in the replace field? Is there some 'magic' variable that can be used for this action?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Just continue with regular expressions

      In the find box:
      @("(This string|value)")@

      in the replace box

      @TEXT(\1)@

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Deepfreeze
        wrote on last edited by
        #3

        Works perfect, thanks!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You're welcome !

          Since the replacement works, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

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