Reputation: 10332
I have such requirement for search&replace in Emacs:
I have a bunch of
'A', 'High'
'B', 'High'
'C', 'High'
'D', 'High'
And the list goes on.
I want to replace them to be:
A = 'High'
B = 'High'
C = 'High'
D = 'High'
Can I query for the pattern, say '#', 'High'
and replace it with #= 'High
?
Upvotes: 1
Views: 52
Reputation: 20342
Move point to beginning of buffer.
M-x query-replace-regexp
.
Enter '\([^']+\)', '\([^']+\)'
as regexp and \1 = '\2'
as replacement.
Press ! to replace all at once, or keep pressing y/n
for each match.
Upvotes: 2