Superb TanParker. It worked like a charm :-)
Looks like \1 was the solution to extract pattern in .*
Thanks.
On Friday, December 18, 2015 at 12:29:06 PM UTC+5:30, TanParker wrote:
> I think the following pattern shoud work
> 
> 
> :%s/Figure of \(.*\) =/\0 \1/g
> 
> 
> 
> > Date: Thu, 17 Dec 2015 22:52:47 -0800
> > From: wherei...@gmail.com
> > To: vim...@googlegroups.com
> > Subject: Search & replace
> > 
> > Hi,
> > 
> > I wanted to search & replace a particular pattern like below
> > 
> > Replace 
> > 
> > Figure of xx = 
> > Figure of yyy = 
> > Figure of ghd = 
> > Figure of yry = 
> > 
> > with
> > 
> > Figure of xx = xx
> > Figure of yyy = yyy
> > Figure of ghd = ghd
> > Figure of yry = yry
> > 
> > I am looking at a command similar to below:-
> > 
> > :1,$ s/Figure of .* = /\0
> > 
> > What I intended was the .* will pick up the characters between "Figure of" & "=" & put it in \0, but looks like \0 takes the value of entire search string. Is there some smart command where I can achieve the above search & replace?
> > 
> > Thanks for the advance help.
> > 
> > -- 
> > -- 
> > You received this message from the "vim_use" maillist.
> > Do not top-post! Type your reply below the text you are replying to.
> > For more information, visit http://www.vim.org/maillist.php
> > 
> > --- 
> > You received this message because you are subscribed to the Google Groups "vim_use" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
--- 
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment