• Login
Community
  • Login

How to find and replace the word in notepad++

Scheduled Pinned Locked Moved Boycott Notepad++
3 Posts 2 Posters 556 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
    S Balaji
    last edited by Mar 28, 2020, 8:08 AM

    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++.

    A 2 Replies Last reply Mar 28, 2020, 12:37 PM Reply Quote 0
    • A
      Alan Kilborn @S Balaji
      last edited by Alan Kilborn Mar 28, 2020, 12:38 PM Mar 28, 2020, 12:37 PM

      @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
      • A
        Alan Kilborn @S Balaji
        last edited by Alan Kilborn Mar 28, 2020, 12:49 PM Mar 28, 2020, 12:49 PM

        @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
        2 out of 3
        • First post
          2/3
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors