I have a word list with a lot of words that I want to convert into a json file. To do this I need to make them strings and add a comma in the end of all words. I figured it would be nice to use regular expression to do this and I know about replace-regexp. What I have tried to do this, beginning with the file:
This
Is
An
Example
To match each word I use ^([A-Za-z]+)$
. I have tried it in https://regex101.com/ and it seems to work the way as expected. But how do I actually use these matches to add a " in front and back of each word to make strings of them?
"This"
"Is"
"An"
"Example"
I can not find in the documentation how to actually use the matches to add more characters.
Edit: After reading https://www.emacswiki.org/emacs/RegularExpression and experimenting with regex101 I found that the words is group 1, so "\1",
(added a comma just to complete the json structure) should work, but it does not
Edit2: Just a more clear example of one of the most promising tries: replace-regexp <RET> ^([A-Za-z]+)$ <RET> "\1",