Community
    • Login

    Replace text inside Quotations

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 2 Posters 445 Views
    Loading More Posts
    • 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.
    • geeman72G
      geeman72
      last edited by

      Hello,

      I am struggling to find an answer to my problem.

      I have a large text file that has lots of strings similar to the below:-

      translation=“-56.3568 13.54 94.6262”
      translation=“116.799 17.376 -142.61”
      translation=“38.3606 5.67512 204.685”

      Each middle number inside the quotes is different but I want them to read all the same, like this:-

      translation=“-56.3568 10.2 94.6262”
      translation=“116.799 10.2 -142.61”
      translation=“38.3606 10.2 204.685”

      Is that even possible with Notepad++?

      Many thanks,

      Greeham

      Alan KilbornA geeman72G 2 Replies Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @geeman72
        last edited by Alan Kilborn

        @geeman72 said in Replace text inside Quotations:

        translation=“-56.3568 13.54 94.6262”
        translation=“116.799 17.376 -142.61”
        translation=“38.3606 5.67512 204.685”

        A quick one that is not entirely rigorous, but fits your data:

        Find: ([\d.-]+) [\d.-]+ ([\d.-]+)
        Replace: ${1} 10.2 ${2}
        Search mode: Regular expression

        More relevant info:

        • https://community.notepad-plus-plus.org/topic/21925/faq-desk-formatting-forum-posts

        • https://community.notepad-plus-plus.org/topic/22022/faq-desk-template-for-search-replace-questions

        • https://community.notepad-plus-plus.org/topic/15765/faq-desk-where-to-find-regular-expressions-regex-documentation

        1 Reply Last reply Reply Quote 1
        • geeman72G
          geeman72 @geeman72
          last edited by

          That’s great thank you, one other question if I might, I forgot to mention there are other strings that are made up of 3 sets of numbers as well but don’t want those changing, so would I add the search to include the word translation at the beginning as well?

          Thanks for the help,

          Greeham

          Alan KilbornA 1 Reply Last reply Reply Quote 1
          • Alan KilbornA
            Alan Kilborn @geeman72
            last edited by

            @geeman72 said in Replace text inside Quotations:

            so would I add the search to include the word translation at the beginning as well?

            Certainly!

            geeman72G 1 Reply Last reply Reply Quote 0
            • geeman72G
              geeman72 @Alan Kilborn
              last edited by

              @Alan-Kilborn Great thanks.

              I have managed it with some additional searching (since I am a new noobie) and worked with this:-

              Find: (?-s)(.+?translation=")([\d.-]+) [\d.-]+ ([\d.-]+)
              Replace: ${1}${2} 99.403 ${3}
              Search mode: Regular expression

              Thanks again,

              Greeham

              Alan KilbornA 1 Reply Last reply Reply Quote 3
              • Alan KilbornA
                Alan Kilborn @geeman72
                last edited by

                @geeman72 said in Replace text inside Quotations:

                and worked with this

                Seems reasonable!

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors