Community
    • Login

    delete line between bookmark

    Scheduled Pinned Locked Moved General Discussion
    45 Posts 4 Posters 14.1k 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.
    • guy038G
      guy038
      last edited by

      Hi, @pinuzzu99 and All,

      That’s it, I got it !. In fact, the new regexes, below, are simply derived from the one given in a previous post of this present discussion :

      https://community.notepad-plus-plus.org/post/50425


      So :

      SEARCH (?-s)^((?!.+@).+\R?)+ ( to delete any bunch of consecutive lines, not containing an e-mail address

      SEARCH (?-s)^((?!.+@).*\R?)+ ( to delete the empty lines, as well ! )

      REPLACE Leave EMPTY

      Notes :

      • These two regexes match any non-null range of lines, which does not contain, each, the @ symbol

      • Of course, if your caret is located somewhere between two e-mail addresses, it will catch, only, from current location till the last line before a line containing an e-mail address

      • With these syntaxes, you may use the step-by-step replacement, with successive clicks on the Replace button

      • It does not mind the lack of a last line-break, at the very end of of the current file

      Best Regards,

      guy038

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

        @pinuzzu99, @Peterjones, @alan-kilborn and All,

        @alan-kilborn, you said :

        And all this in a forum that isn’t about regular expressions, but rather Notepad++!

        You’ve got a point, there !! @Scott-sumner felt the same way, in this post :

        https://community.notepad-plus-plus.org/post/35723

        Have a look, at the same time, to my reply and question :

        https://community.notepad-plus-plus.org/post/35742

        Again, I wonder if most of my answers are relevant, in this forum ? I mean, all this should be dealt with in a forum dedicated to regular expressions However, note that I specifically speak about N++ functionalities of our regex engine !

        Ah, ah : that could be a government slogan : Too many regular expressions can seriously damage your health !

        Cheers

        guy038

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

          @guy038

          I think some degree of discussion is quite fine and appropriate. People start out with some data, a need to do something to it, and a tool (our beloved N++). What else are they to do but ask (on a N++ forum) “how can I do this with N++?” And that’s totally fine.

          And the “weirdness” of the N++ engine? Also a very good topic here.

          But, yea, slogging thru a lot of posts of typical regex handholding gets old, and I agree with you that it is better on a regex dedicated site. Hopefully you are patrolling those as well and helping the rest of the world with regex! :-)

          1 Reply Last reply Reply Quote 2
          • PeterJonesP
            PeterJones @pinuzzu99
            last edited by

            @pinuzzu99 said in delete line between bookmark:

            greeting to all. closed.

            You’ll probably not read this (or see Guy’s excellent reply), but for future readers of this thread, I have to make a couple more statements

            I wasn’t sure that guy038 was answering me,

            Because it took more than 12 hours!? For future readers: some problems take more than 30seconds to solve, and on non-live forums, it can take a day or two.

            and since nobody was helping me here,

            We were all helping you. And both Guy and I answered almost simultaneously today explaining exactly why replace all worked but replace (once) didn’t. If that’s not helping you, I don’t know what is.

            Beyond that, we were helping you, explaining that in help forums, asking politely, not demanding immediate response, and showing an effort to learn is a much better way to get help.

            I asked my question and not only as you say it has not been closed, but indeed they replied immediately

            Well, the userbase of of Stack Exchange is probably a thousandfold more than this Community, so there are a lot more to draw from.

            1 Reply Last reply Reply Quote 2
            • pinuzzu99P
              pinuzzu99
              last edited by

              @guy038 tank you so much, your last string (?-s)^((?!.+@).+\R?)+ work very well for my purpose! Regards.

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