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



  • abc

    abc

    abc a abc a abc
    abc abc a abc
    abc a abc abc



  • 2x double space



  • @Pan-Jan ,

    Since you have not used the forum’s toolbar or markdown to properly format the data, we cannot tell what you have or what you want.

    This next paragraph will help you ask your question better. Good luck.

    ----

    Do you want regex search/replace help? Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you. All example text should be marked as plain text using the </> toolbar button or manual Markdown syntax. Screenshots can be pasted from the clipbpard to your post using Ctrl+V to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have and the text you want to get from that data; include examples of things that should match and be transformed, and things that don’t match and should be left alone; show edge cases and make sure you examples are as varied as your real data. Show the regex you already tried, and why you thought it should work; tell us what’s wrong with what you do get… Read the official NPP Searching / Regex docs and the forum’s Regular Expression FAQ. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries.



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

    we cannot tell what you have or what you want.

    That said, based solely on your title, I would think typing two spaces into the FIND box would do what you want.



  • This post is deleted!


  • Schowek01.jpg



  • 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.



  • 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



  • 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.



  • @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)



  • 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



  • 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



  • 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.



  • Hi @pan-jan,

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

    BR

    guy038



  • @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.



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



  • 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



  • this is it:
    Schowek02.jpg


Log in to reply