I have an input file like this
line 1
line 2
line 3
There are four spaces before all the lines I want to replace.
I want the end result to be:
A[line 1
A[line 2
A[line 3
(Its funny, so editor doesn’t want to display line by line)
I tried M-x replace-regex ^[]+ -> A\[, but get error invalid regex "Unmatched [ or [^"
I tried M-x replace-regex ^[]+ -> A[, but get same error.
Replacing the [ is a problem. How to fix this?
Try
In your examples you are missing a space inside the character class:
^[ ]+Prettier would probably be:
^[[:space:]]+for every kind of white-space.