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