I'm having trouble getting query-regex-replace to do what I want. I've read the docs several times and still can't figure it out. Here are a few examples of things I can't figure out how to do with query-regex-replace:
- Replace a bunch of whitespace on one line followed by "*" with just "*" (get rid of the whitespace.
EDIT - I got this to work with [[:space:]]+\*
RET *
RET
- Replace two forward slashes followed by non white space with two forward slashes and white space (insert a space before the first non white space character).
EDIT - I also got this to work with //\([^[:space:]]+\)
RET // \1
- Get rid of blank lines (optionally of course because this is a query replace).
EDIT - I still cannot get this to work. Among other things, I tried these:
)[[:space:]]+{
RET ) {
RET
and
)\s-+{
RET ) {
RET
Thanks for any help.
query-replace-regexp
. Check outwhitespace-cleanup
for (1),comment-dwim
for (2), anddelete-blank-lines
for (3). Unless you're batch cleaning up files, the options I suggested should be a better fit.C-x C-o
to delete blank lines. Thanks for the link @Tianxiang Xiong