On Fri, 28 Apr 2006, Suresh Govindachar wrote:
> Gerald Lai sent on Thu, 27 Apr 2006 17:44:05 -0700 (PDT):
>> On Thu, 27 Apr 2006, Suresh Govindachar wrote:
[snip]
> What do you intend to do with the mapping?
The line would have several '|' characters in it; I want @a to
contain the the stuff after the very last '|' but without any
leading or trailing white space in the captured stuff:
So, for example, if the line was:
stuff | more stuff | want this gold
then @a should contain "want this gold" (without quotes)
[snip]
This is what I got:
nmap <space> :let @a = matchstr(getline('.'),
'^.*<Bar>\s*\zs.\{-}\ze\s*$')<CR>
As a rule of thumb, I always replace every "|" character with "<Bar>" in
mappings.
HTH :)
--
Gerald