On Fri, Oct 10, 2008 at 23:09, fritzophrenic <[EMAIL PROTECTED]> wrote:
> On Oct 10, 2:08 am, "Dmitry Teslenko" <[EMAIL PROTECTED]> wrote:
>> Hello!
>> Does vim support multiline patterns with pockets?
>> If it does, then what pattern would match this:
>>
>> {
>> Type * variantName = ....;
>> variantName->someMethod();
>>
>> }
>>
>> i.e. search all places where variable of type "Type" was used,
>> "someMethod" was called and variant name may vary.
>>
>
> I don't actually know what you mean by "pockets".
It's term I met in php documentation for search pacleholders or backreferences.
> One pattern that might work:
>
> /Type\s*\*\s*\(\k\+\)\s*=\_.\{-}\zs\1->someMethod()
>
> It could potentially be very inefficient, though. Also, it has no
> knowledge of the scope of the variable.
>
> Explanation:
>
> Type\s*\*\s* : match "Type *" with any amount of whitespace
> \(\k\+\) : match any keyword characters and store it in a
> backreference for later
> \s*= : match any whitespace and an '=' character (you've indicated
> this is what you want).
> \_.\{-} : match _as_little_as_possible_ of any character (including
> newlines) before you match the following
> \zs : start the match here (the cursor will be placed here when you
> search)
> \1 : match the 1st backreference, which is the variable name you want
> ->someMethod() : match the method name
Big thanks!
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---