Monday, July 27, 2015

Re: gvim search and replace

On Monday, July 27, 2015 at 5:24:58 PM UTC+5:30, Tim Chase wrote:
> On 2015-07-27 04:05, Melvin Simon wrote:
> > Hi,
> >
> > I am new to gvim editor. Needed a small help regarding gvim search
> > and replace.
> >
> > I needed to search and replace as:-
> >
> > AIO_P71_TSD0_CTRL with AIO_PRI_TSD0_CTRL
> > AIO_P71_TSD1_CTRL with AIO_PRI_TSD1_CTRL
> > AIO_P71_TSD2_CTRL with AIO_PRI_TSD2_CTRL
> >
> > I tried the below:-
> >
> > >s/AIO_P71_TSD\.*_CTRL/AIO_PRI_TSD\0_PRI_CTRL/g
> >
> > i.e. I was guessing \0 would print the characters (here 0,1,2)
> > matched by .* however looks like its matching the entire word. Can
> > some one tell me how to accomplish the above search and replace.
>
> You're close. Try
>
> :%s/AIO_\zsP71\ze_TSD.*_CTRL/PRI/g
>
> You can read up about \zs and \ze at
>
> :help /\zs
> :help /\ze
>
> -tim

Thank you Tim! Perfect!

--
--
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: