Replace string between quotes
-
Hello npp community!
So, i searched the forum but was unable to find something that suits my needs.
Lets say I have a file with many strings like:
/* ... */ "str1" /* ... */ "str2" /* ... */ "str100" /* ... */I want to add something before and after the quotation, but keep the content of the string, not sure if this is clear!
Example :
I want the above to be like/* ... */ xor("str1").crypt() /* ... */ xor("str2").crypt() /* ... */ xor("str100").crypt() /* ... */Is that possible?
-
Yes, it is possible. The following regex does what you want given the data you provided:
Open the Replace dialog (
Ctrl + H) and type in:Search: ^("[^"]+")$ Replace: xor\($1\).crypt\(\)Check the
Wrap aroundoption
Select theRegular expression searchmode
Click on theReplace AllbuttonHave fun!
-
Oh thanks! Seems like I have to study some RegEx :)
Appreciate your answer!
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