>
> On 26 nov, 20:42, epanda <callingel...@hotmail.fr> wrote:
>> Hi,
>>
>> I would like to detect all returns that follow an if like that :
>>
>> if (condition1
>> && condition 3 )
>> return
>>
>> or
>>
>> if (condition1
>> && condition 3 )
>> // COMMENT
>> /*
>> *
>> * ANOTHER COMMENT
>> *
>> */
>> return
>>
>> Thanks
>
>
> I detect this case
>
> if ()
> return
>
> with that regexp : )\(\s\{0,20}\n\{0,20}\s\{0,20}\)\{0,20}return
>
> How can I complete the rgexp to detect this case
> if()
> //
> /* ***
> ********/
> return
Pattern for a C-comment (with leading slash for the search command):
/\/\*\_[^*]*\*\+\%(\_[^\/*]\_[^*]*\*\+\)*\/
Pattern for a Line-comment:
/\/\/.*\n
You want something like:
/)\_s*\%(\%(C-comment\|Line-comment\)\_s*\)\{-}return
Now, "C-comment" and "Line-comment" replaced with the real patterns:
/)\_s*\%(\%(\/\*\_[^*]*\*\+\%(\_[^\/*]\_[^*]*\*\+\)*\/\|\/\/.*\n\)\_s*\)\{-}return
hth, no warranty.
--
Andy
--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment