Community
    • 登入

    Edit just one ocurrence in all files, not all ocurrences in all files.

    已排程 已置頂 已鎖定 已移動 Help wanted · · · – – – · · ·
    17 貼文 2 Posters 940 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • D.A.G 13D
      D.A.G 13
      最後由 編輯

      @Terry-R said in Edit just one ocurrence in all files, not all ocurrences in all files.:

      (?-s)(.?)\x20(?s)(.)

      Thanks man, it worked, sorry if i’m being greedy, but, can you make it place the “{” in just one click? If it’s not much the trouble.

      Terry RT 1 條回覆 最後回覆 回覆 引用 0
      • Terry RT
        Terry R
        最後由 Terry R 編輯

        @Terry-R said in Edit just one ocurrence in all files, not all ocurrences in all files.:

        Find What:(?-s)(.?)\x20(?s)(.)

        I wish to revise that as a bit more thought revealed an issue. In fact the above regex will find the first occurrence of a blank space, regardless of which line it is. To anchor it to the first line I changed it to be
        Find What:(?-s)\A(.*?)\x20(?s)(.*)
        For the question in this thread the first regex would still perform correctly as OP stated there was a blank space in the first line of every file.
        Terry

        1 條回覆 最後回覆 回覆 引用 1
        • Terry RT
          Terry R @D.A.G 13
          最後由 編輯

          @D-A-G-13 said in Edit just one ocurrence in all files, not all ocurrences in all files.:

          but, can you make it place the “{”

          Can you provide an example. I don’t understand the question. Are you wanting to replace the blank space with the “{” or insert this somewhere (else)?

          Terry

          1 條回覆 最後回覆 回覆 引用 0
          • D.A.G 13D
            D.A.G 13
            最後由 D.A.G 13 編輯

            For example, it anchors it of the beginning to the text, but i have to press the replace button several times for it, if you could make it to attach it in one click would be nice

            1 條回覆 最後回覆 回覆 引用 0
            • Terry RT
              Terry R
              最後由 編輯

              @D-A-G-13 said in Edit just one ocurrence in all files, not all ocurrences in all files.:

              but i have to press the replace button several times for it,

              Are you pressing the “Replace All in All Opened Documents” button. This WILL make a replacement in ALL OPENED files within Notepad++.

              Terry

              1 條回覆 最後回覆 回覆 引用 0
              • D.A.G 13D
                D.A.G 13
                最後由 編輯

                Yes, but i moves just one space per click until it reaches the beginning of the file, i’m looking to make it reach the beginning in just one click.

                Terry RT 1 條回覆 最後回覆 回覆 引用 0
                • Terry RT
                  Terry R
                  最後由 Terry R 編輯

                  @D-A-G-13 said in Edit just one ocurrence in all files, not all ocurrences in all files.:

                  is there any way to edit just one ocurrence in all the opened files instead of all the ocurrences in all files?

                  This was your original question. You then followed that up with
                  “is there a way to delete that space of the line 1 in all the opened files?”
                  The solution removes the first occurrence of a blank space in all opened files if the blank space occurs on line 1.

                  So if the solution does NOT meet your needs I think you need to explain more. Perhaps use some examples. Insert examples, then select them and click on the </> button immediately above the posting window. This will prevent the posting engine from changing any example text.
                  At the moment I’m confused as to your request and the closest I can see is that you want the first occurrence on every line of a blank space to be replaced???

                  Terry

                  1 條回覆 最後回覆 回覆 引用 1
                  • Terry RT
                    Terry R @D.A.G 13
                    最後由 編輯

                    @D-A-G-13 said in Edit just one ocurrence in all files, not all ocurrences in all files.:

                    but i moves just one space per click until it reaches the beginning of the file

                    Oh hang on. Do you mean some of the files have more than 1 blank space together that you need to remove. If so then please use the 2nd regex (that has the \A in it) and change the \x20 to \x20+. This will select multiple blank spaces together and therefore removes them in 1 click.

                    Terry

                    D.A.G 13D 1 條回覆 最後回覆 回覆 引用 1
                    • D.A.G 13D
                      D.A.G 13 @Terry R
                      最後由 編輯

                      @Terry-R It worked perfectly, thanks a lot man, you’re my hero.

                      1 條回覆 最後回覆 回覆 引用 0
                      • Terry RT
                        Terry R
                        最後由 Terry R 編輯

                        @D-A-G-13 said in Edit just one ocurrence in all files, not all ocurrences in all files.:

                        It worked perfectly,

                        I’m glad we got there eventually. It was hard work though.

                        If you ask any further questions please do supply examples. If the data is sensitive (confidential) then alter the data but keep the structure as it originally was. It’s very important that examples as supplied for the very reason as shown in this thread. Presumably English isn’t your primary language as it seems you didn’t understand some of the questions well enough to give complete answers. That’s why examples are very important. Generally about 5 or so lines before and using the same example lines, repeat them showing the result you were expecting to get.

                        Terry

                        1 條回覆 最後回覆 回覆 引用 3
                        • 第一個貼文
                          最後的貼文
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors