On Wed, Oct 8, 2008 at 11:48 AM, Ivan Tishchenko wrote:
>> Hello,
>>
>> I'm trying to find a regex to remove the file extension from a list of
>> files.
>>
>> For example,
>>
>> src/foo.txt
>> src/bar.tgz
>> .vim/myfile.vim
>> project.git/index.html
>
> Don't know about matching problem, but the job can be accomplished by
>
> %s/\.[^./]*$//c
>
> WBR,
> Ivan.

A slight tweak to fix the original approach would be

:%s/.*\zs\..\{-}$//

Or, a more verbose option would be this:

:%s/.*/\=fnamemodify(submatch(0), ':r')

~Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to