Community
    • Login

    How to find and replace the word in notepad++

    Scheduled Pinned Locked Moved Boycott Notepad++
    3 Posts 2 Posters 1.1k 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.
    • S BalajiS Offline
      S Balaji
      last edited by

      Sample:
      strcpy(p_add.arr,pname);
      strcpy(p_name,p_show.arr);
      strcpy(p_name.arr,p_name2.arr);

      To Find:
      strcpy(.arr,.arr)—i Have facing the error “0 hits showing” but will be there like in sample.

      To Replace:
      strcpy((char ).arr,(char ).arr).

      I have to add the (char *) prefix in the array variables.So kindly provide the command in notepad++.

      Alan KilbornA 2 Replies Last reply Reply Quote 0
      • Alan KilbornA Offline
        Alan Kilborn @S Balaji
        last edited by Alan Kilborn

        @S-Balaji

        It IS rather a tricky one, but give this a try:

        Find what box: strcpy\((.*?),
        Replace with box: strcpy\(\(char *\)$1,\(char *\)
        Match case checkbox: ticked
        Search mode radiobutton: Regular expression

        It might need to be made more “restrictive”, but I think the above works for what you’ve shown as data.

        The key part that people might miss is that you need to escape the parentheses EVERYWHERE they appear.

        1 Reply Last reply Reply Quote 2
        • Alan KilbornA Offline
          Alan Kilborn @S Balaji
          last edited by Alan Kilborn

          @S-Balaji

          Of course, it may be prudent to limit the scope of the .*? part by adding a leading (?-s):

          Revised Find what box: (?-s)strcpy\((.*?),

          Also, I said:

          escape the parentheses EVERYWHERE…

          I should have said:

          “escape the literal parentheses EVERYWHERE…”

          The parentheses in these substructs are not the literal ones: (?-s) and (.*?)

          Sorry for any confusion. :-)

          1 Reply Last reply Reply Quote 1

          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