Community
    • Login

    Delete line

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 2 Posters 2.4k 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.
    • cisco779kC
      cisco779k
      last edited by

      Hi, I’ve one txt file like this:
      Title: Fred Montana
      Date: 31 Avril 2017

      Title: Doors
      Date: 22 may 2015

      etc…

      I want delete all lines with Date: …

      I I’ve try with search & replaced with extended mode and entry Date: .* but not work…
      How to del all line with text Date: … ??

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

        Hello, @renso-petrulli,

        Very easy, indeed ! You should have tried the Regular expression mode, instead :-))

        SEARCH (?-i)^Date.*\R?

        REPLACE Leave EMPTY

        Notes :

        • The first part (?-i) forces the search to be sensitive to case. If the word Date may have any case, change for (?i)

        • Then, the ^ symbol is an zero-length assertion, which means beginning of Line

        • The part Date.* represents the word Date, followed by any range of characters, even empty

        • Now, the \R syntax stands for any line-break ( End of Line characters )

        • Finally, the ? quantifier, equivalent to {0,1} means that the line-break may be present or NOT ( case of a last line Date…, without any line-break, at its end ! )

        • As the replacement zone is empty, the entire current line is deleted


        Note the difference with the following S/R

        SEARCH (?-i)^Date.*

        REPLACE Leave EMPTY

        In that case, any line, beginning with the word Date, is replaced by a pure blank line

        Best Regards,

        guy038

        1 Reply Last reply Reply Quote 0
        • cisco779kC
          cisco779k
          last edited by

          Yes! Thank you very much!
          Regards. RP

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