Friday, April 23, 2010

Re: regex for a range that has a given number?

On 04/23/2010 11:33 AM, Benjamin R. Haskell wrote:
> On Fri, 23 Apr 2010, Christian Brabandt wrote:
>> On Do, 22 Apr 2010, Tim Chase wrote:
>>
>>> function! FootSearch(fn)
>>> [...]
>>> Any bugs are yours to keep ;-)
>>
>> This is one I noticed:
>> :s/\%(fu.*\)\@<!fn/a:&/g
>
> Gesundheit!
>
> For those following along who aren't regexperts, the 'fn' parameter
> should be referred to as 'a:fn' inside Tim's FootSearch function.

In the above case, I'd just use

:v/function/s/\<fn\>/a:&/g

which reads a little more cleanly to me. I confess I don't
use/write vim functions often, so I frequently forget the "a:"
scope modifier for function arguments until I actually test/run
the function and get errors. Enough bugs and it could have been
called a FootGun function ;-)

-tim


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

Subscription settings: http://groups.google.com/group/vim_use/subscribe?hl=en

No comments:

Post a Comment