On Thu, May 5, 2011 4:55 pm, cyboman wrote:
> i'm writing a script to modify the copyright notice. the problem is
> that are multiple notices in the file. i need to be able to find a
> line where the last notice occurs. vim search() function finds only
> the first pattern occurrence. does anybody know of a way to find the
> last pattern occurrence?
>
> here is the example:
>
> copyright 2008, company a
> copyright 2009, company b
> copyright 2010, company c
> copyright 2011, company d
>
> i need to be able to find the last occurrence of the following pattern
> copyright \d\{4}.
Jumping to the last line and searching backwards should work:
:$
:echo search('copyright \d\{4}', 'bnW')
regards,
Christian
--
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