Re: vi and quoted strings ...
On Mon, May 05, 2003 at 09:46:21AM +0100, Dave Selby wrote:
> In vi the following usually works ...
> :1,$s/search text/replace text/g
>
> However because the search text has / in it it brings up the error
> message "trailing characters"
> I have tried quoting it in ' ' and " " same error message. - any ideas ?
For something like this the best way is probably to use a different
character for the regex, I usually use a hash. If you use
"s#search#replace" it's the same as "s/search/replace", except that
slash is no longer special.
You can also escape each slash with a backslash, but that's messy when
you have a lot of them (like in a full path).
--
Michael Heironimus
Reply to: