On Mon, Jun 26, 2006 at 04:48:25PM +0530, Jerin Joy wrote:
> The replace all option 'g' doesn't seem to be working in my case. It
> replaces only the first occurrence on a line.
>
> for eg. in the following line I wanted to remove the extra whitespaces
> between input [] and the name of the variable:
> task init (input [1:0] u, input [3:0] hash, input [3:0] hash_index1)
>
> Using:
> :%s/\][\ ]\+/\]\ /g
>
> replaces only for the first variable - input [1:0] u
It works for me. Are you sure the characters in the gaps are all spaces
and there are no tabs in there?
Also, you can simplify your expression. You don't need to backslash
the characters in the replacement, and the [\ ] can be replaced with
a literal space:
:%s/] \+/] /g
If there are tabs in the line you can use \s instead of space in the
pattern:
:%s/]\s\+/] /g
--
Matthew Winn ([EMAIL PROTECTED])