I am sure this has been asked before, but I am not sure how to search for the exact case.
How do I use regex to search/replace for whatever is inside double quotes, such as:
"Sample text"
and replace it with:
\command{Sample text}
where "Sample text" can be anything.
Depends what tool/language you're using, but in general:
Search: "(.*?)"
Replace: \\command{$1}
This works by capturing (in group 1) the text inside quotes and using a back reference to that group in the replacement.
Your tool/language may use backslash instead of dollar to indicate the group number, ie try \\command{\1} instead if the above doesn't work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With