Community
    • Login

    Search/Replace question regarding Replace part

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 334 Views 1 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.
    • Lycan ThropeL Offline
      Lycan Thrope
      last edited by Lycan Thrope

      Hey folks,

      I’m having a little problem trying to figure out the reason that a search text I’m looking for, upon replacement, is getting a space inserted after the CRLF.

      Searched text:

      DEFINE FORM ACCT_REC ; 
      

      Desired replaced text:

      *Define Open
      DEFINE FORM ACCT_REC ; 
      

      With these S/R strings:
      S:^(Define.*\h)$
      R:*Define Open\r \1
      Regular Expression: checked
      Newline matches: unchecked

      The current results is getting a space put in at the start of the second line like this:

      *Define Open
       DEFINE FORM ACCT_REC ; 
      

      I have tried putting the ^ in the replace text to try and force it to the left margin with no success, and I’m sure if I keep plugging away, I’ll probably stumble into the answer, but I thought I’d pick someone elses brain today as mine seems to be coming down with a cold or something after Jury Duty yesterday from someone sitting next to me and my head is a little dysfunctional today. :-)

      Thanks in advance for any direction to educate my brain today.

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA Offline
        Alan Kilborn @Lycan Thrope
        last edited by

        @Lycan-Thrope said in Search/Replace question regarding Replace part:

        \r

        First, don’t do that, if you have Windows formatted files (the usual case).
        You want to use \r\n.

        Lycan ThropeL 1 Reply Last reply Reply Quote 3
        • Lycan ThropeL Offline
          Lycan Thrope @Alan Kilborn
          last edited by Lycan Thrope

          @Alan-Kilborn ,
          Thanks, I did try that already, but the result is the same. It still puts that space in at the start of the line. :-(

          Edit: But thanks for the input and I did find the problem after looking at it again…It’s my fault. I added a space in the Replace line. DOH!! I also added the \n, as well so thanks.

          Told you my head wasn’t working right today. :)

          1 Reply Last reply Reply Quote 2

          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