delete line between bookmark

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

    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 ! )


    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,


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

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

    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 !



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

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

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

Log in to reply