Community
    • Login

    Find exact lines

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 2.7k 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.
    • Gabriel CliftonG
      Gabriel Clifton
      last edited by

      I am looking for a way to replace EXACT lines. I have a file that has "Word " (with space, without quotes) at the beginning of each line. What I am wanting to do is replace every line that contains "Word " with nothing after it. For example:

      Word
      Word this is the next line
      Word another line
      Word

      becomes
      Word,
      Word this is the next line
      Word another line
      Word,

      Scott SumnerS 1 Reply Last reply Reply Quote 0
      • Scott SumnerS
        Scott Sumner @Gabriel Clifton
        last edited by

        @Gabriel-Clifton

        Not too hard, try this:

        Find-what zone: Word\x20$
        Replace-with zone: Word,
        Search-mode: Regular-expression

        You can use a plain old space instead of the \x20 but I like to use \x20 here on this site because it is more visible. Either works when you are actually doing it.

        So in the spirit of learning something, the $ is the key element here. It basically means end-of-line…so you are searching for W…o…r…d…space…followed by nothing else on the line. Replacement affects only those cases where a search match occurred, obviously.

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