On Mon, October 15, 2012 16:14, porphyry5 wrote:
> On Sunday, October 14, 2012 4:59:28 PM UTC-7, coot_. wrote:
>> On 15:25 Sun 14 Oct     , Graham Lawrence wrote:
>>
>> > :echo substitute(@%, "\..*", "", "")
>>
>> >
>>
>> > :echo substitute(@%, "\([^.]\+\)\..*", "\1", "")
>>
>> > Parameters2.html
>>
>> >
>>
>> > >From :reg
>>
>> > ":   echo substitute(@%, "\([^.]\+\)\..*", "\1", "")
>>
>> > "%   Parameters2.html
>>
>> >
>>
>> > So, how should I write this substitute command?
>>
>> >
>>
>> >
>>
>> > --
>>
>> > Graham Lawrence
>>
>> >
>>
>> > --
>>
>> > 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
>>
>>
>>
>> Are you looking for:
>>
>> :echo expand("%:r")
>>
>>
>>
>> :help filename-modifiers
>>
>>
>>
>> Best,
>>
>> Marcin
>
> Many thanks, that solves the immediate problem perfectly.  But I would
> also like to know why substitute() does not, if possible.

Because of the way, Vim parses the regular expression in a quoted string.
If you use double quoted strings, you need to double the backslashes,
alternatively, simply use single quoted strings.

:h expr-string
:h literal-string

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

Reply via email to