Community
    • Login

    How to find and replace the word in notepad++

    Scheduled Pinned Locked Moved Boycott Notepad++
    3 Posts 2 Posters 404 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
      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
        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
          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
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors