How to find and replace the word in notepad++
-
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++.
-
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 expressionIt 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.
-
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. :-)
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