vim regex for replacing spaces within quotes
Posted
by vikram-bhat
on Stack Overflow
See other posts from Stack Overflow
or by vikram-bhat
Published on 2010-06-04T13:58:33Z
Indexed on
2010/06/05
13:12 UTC
Read the original article
Hit count: 212
I have text in the follwing format:
ERR_OUT_OF_MEM, "ERR OUT OF MEM"
ERR_SOMETHING_BAD, "ERR SOMETHING BAD"
I want to replace all spaces in the text which are within quotes with underscores:
ERR_OUT_OF_MEM, "ERR_OUT_OF_MEM"
ERR_SOMETHING_BAD, "ERR_SOMETHING_BAD"
The best regex I could come up with is:
\("\w\+\)\@<=
(there's a space at the end of that)
but this only finds the first space in each quoted string, and I would need to repeat this multiple times to get the desired effect.
Any way to do it in one shot?
Thanks!
© Stack Overflow or respective owner