Community
    • Login

    I would like to find lines where there are 2x double spaces

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    18 Posts 4 Posters 2.3k 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.
    • Thomas 2020T
      Thomas 2020 @PeterJones
      last edited by

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • Thomas 2020T
        Thomas 2020 @PeterJones
        last edited by

        Schowek01.jpg

        1 Reply Last reply Reply Quote 0
        • Thomas 2020T
          Thomas 2020
          last edited by

          Subject title contains an error … should be:
          I would like to find lines where there are 2x double spaces

          and it should be possible to correct it.
          This is the biggest mistake of this forum.
          There are others, but that’s another topic.

          1 Reply Last reply Reply Quote 0
          • guy038G
            guy038
            last edited by guy038

            Hello , @pan-jan and All,

            I had to look at your picture several times to understand what you’re hoping for ! So, you want to find all the lines containing, at least, two strings containing, each, 2 consecutive space characters ;-))

            However you don’t tell us witch process you intend to do with these lines :

            • A Do you want to select all contents of these lines ?

            • B Do you want to select all contents of these lines and their line-breaks ?

            • C Do you want to find each double-space occurrence of these lines ?

            • D Do you want to bookmark these lines for further process with the Search > Bookmark sub-menu ?

            • E Do you want to delete these lines ?

            • F Do you want to perform some kind of replacement in these lines ?

            …

            Here are the regex solutions for cases B and C :

            Regex B (?-s)^.+\x20{2}.+\x20{2}.+\R?

            Regex C (?-s)\x20{2}(?=.+\x20{2})|\G.+?\K\x20{2}

            Regarding the regex C :

            • It can be shortened as (?-s)(\x20{2})(?=.+(?1))|\G.+?\K(?1), using the sub-routine calls structure (?#)

            • As expected, it does not find an unique double-space string of a line

            • As soon as a line contains, at least, two double-space strings, it matches any double-space string

            Best regards,

            guy038

            Thomas 2020T 1 Reply Last reply Reply Quote 0
            • Thomas 2020T
              Thomas 2020 @guy038
              last edited by

              Thanks.
              I use AkelPad as the editor
              and the pattern doesn’t work there … and not only there.

              ^\w+\s\s.+\s\s\w+$

              I thought I would see another solution here.
              $ at the end if \r or \n … in AkelPad they don’t work.

              For me AkelPad has an advantage over Notepad ++ and is therefore its slave.

              PS. I don’t know English, that’s why I make various mistakes.
              The translation of Notepad ++ into Polish also has a lot to be desired.
              Thank you again.

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

                @guy038 said

                you want to find all the lines containing, at least, two strings containing, each, 2 consecutive space characters

                I think your regexes are correct, but your restatement of the problem makes my head hurt. Maybe by the nature of the problem it is hard to state it cleanly. :-)

                @Pan-Jan said:

                The translation of Notepad ++ into Polish also has a lot to be desired.

                Don’t complain about it, do something about it.
                Translations are user-provided.
                (The developers can’t be expected to be fluent in all possible languages)

                1 Reply Last reply Reply Quote 0
                • guy038G
                  guy038
                  last edited by guy038

                  Hi @pan-jan,

                  Ah… of course, the provided regexes work only with the Boost regex engine, implemented within Notepad++ !

                  And I bet that specific regex syntaxes as \R ( line-break character(s) ) or the \G assertion won’t work with the Akelpad editor :-((

                  Generally speaking, this forum is specifically devoted to Notepad++


                  Now, you may download a portable X86 Notepad++ version, just for a test !

                  • Download the latest N++ version from below :

                  https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.8.8/npp.7.8.8.bin.zip

                  • Extract all its contents in any folder, even on your desktop

                  • Double-click on the notepad++.exe file

                  • Open your file ( Ctrl + O )

                  • Open the Find dialog ( Ctrl + F )

                  • Type in (?-s)^.+\x20{2}.+\x20{2}.+\R?    OR    (?-s)\x20{2}(?=.+\x20{2})|\G.+?\K\x20{2}, in the Find what: zone

                  • Tick the Wrap around option

                  • Select the Regular expression search mode

                  • Click, repeatedly, on the Find Next button !

                  Cheers,

                  guy038

                  1 Reply Last reply Reply Quote 0
                  • guy038G
                    guy038
                    last edited by

                    Hi, @alan-kilborn,

                    Alan, what’s bugging you about my answer? Maybe I misspoke, in English !

                    Don’t hesitate ! I’ll try to do my best to make things clear ;-))

                    Cheers,

                    guy038

                    Alan KilbornA 1 Reply Last reply Reply Quote 0
                    • Thomas 2020T
                      Thomas 2020
                      last edited by

                      Everything is OK.
                      I don’t complain about anything, the translator explains it.
                      I will translate from Polish to English and again into Polish.
                      Then I’ll see what nonsense comes out to me.

                      1 Reply Last reply Reply Quote 0
                      • guy038G
                        guy038
                        last edited by

                        Hi @pan-jan,

                        Note that, in my short previous post, I was talking to @alan-kilborn, specifically !

                        BR

                        guy038

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

                          @guy038 said in I would like to find lines where there are 2x two spaces:

                          Alan, what’s bugging you about my answer? Maybe I misspoke, in English !

                          No worries.
                          I was just thinking that, for all the times that we complain that a poster hasn’t provided a good explanation of their problem/need, that this one is really hard to state, IMO.

                          Maybe:

                          “Find lines where two space characters occur two times”

                          Perhaps that’s not so bad, but the two occurrences of two feels strange.

                          Maybe the thread title is the best way to express it.

                          Anyway; rambling…your solution is fine, as I stated before.

                          Thomas 2020T 1 Reply Last reply Reply Quote 0
                          • Thomas 2020T
                            Thomas 2020 @Alan Kilborn
                            last edited by

                            Maybe the thread title is the best way to express it.
                            And the title of the thread cannot be changed and is misleading.

                            1 Reply Last reply Reply Quote 0
                            • guy038G
                              guy038
                              last edited by

                              Hi, @pan-jan,

                              As a moderator, I succeeded to change the title of your initial post, as you wanted to but I could not re-insert the last two lines of your text because, on clicking on the Submit button, it always repeats that it considers this post as a spam :-( Sorry !

                              BR

                              guy038

                              1 Reply Last reply Reply Quote 0
                              • Thomas 2020T
                                Thomas 2020
                                last edited by

                                this is it:
                                Schowek02.jpg

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