Community
    • Login

    Find exact lines

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 3.2k Views 2 Watching
    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 Offline
      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 Offline
        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

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors