Stahlman Family wrote:
> 
> jojahti wrote:
>> I have tried write highligting pattern, than search variables. 
>> "\(\(int\|long\|short\|char\|void\|double\)[[:space:]]\+\)\@<=[^[:space:]^(^).]\+\([[:space:]]\)\@
>> =" 
>>  
>> Then the pattern, that search this variable in other places of the file. 
>> "\(\(int\|long\|short\|char\|void\|double\)\([[:space:]]\+\)\([^[:space:]^(^).]\+\)[[:sp
>>    
>> ace:]].*\)\@<=\4" 
>> But fail. 

Now I'm confused as to what you're actually attempting to do... The 
wording above makes it sound as though you're trying to extract a 
variable name from a declaration with one pattern, then find its usage 
later in the file with another pattern. The patterns themselves, 
however, aren't consistent with this interpretation, as both match the 
variable type. Perhaps it would help if you clarified exactly how you're 
using the 2 patterns above...

Thanks,
Brett Stahlman

>>  
>> I see, that this thing have very strange behavior. 
>> I have made little experiment/ 
>> I make this string: 
>> oo ib   b oooooooooo 
>>  
>> And try serch in it, using this pattern: 
>> '\(i\(.\)[[:space:]]*\)\@<=/2' 
>> And now i have fail. 
>> But if i cut '\@<=' - then all work normal. 
>> But I need to use these things. 
> 
> Jojahti,
> There's a better way to do what you're trying to do, which uses \zs 
> instead of \@<=.
> 
> :help \zs
> 
> As Ben Fritz pointed out, the pattern within...
> \( ... \)\@<=
> ...is tried only *after* the actual pattern is matched; i.e., too late 
> for the submatches contained by the lookbehind to be used in the actual 
> pattern. But what if you changed the pattern above to the following?
> 
> \(i\(.\)[[:space:]]*\)\zs\2
> 
> The \zs ensures that the match begins at the character matched by \2; 
> the difference between this and the original pattern is that the portion 
> of the pattern before the \zs is tried *first* (as it really must be if 
> the \2 backreference is to be useful).
> 
> Out of curiosity, what are you trying to match with [^[:space:]^(^).]?
> 
> Thanks,
> Brett Stahlman
> 
> 
> 
>>  
>> Why behavior of it is so strange? How to me complete my quest the most
>> adequate way? 
> 
> 
>>  
>> P.S. it's my first post in English. :thinking:
>> Forums on my native language, where I can ask this question - about zero.
>>
>>
> 

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

Reply via email to