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 around
option
Select theRegular expression search
mode
Click on theReplace All
buttonHave fun!
-
Oh thanks! Seems like I have to study some RegEx :)
Appreciate your answer!