1

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?

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.