On Jul 19, 4:49 pm, Tony Mechelynck <[email protected]>
wrote:
> On 19/07/09 12:54, sinbad wrote:
>
>
>
> > hi,
>
> > How to match a C function declaration. I tried the following but
> > didn't work.
>
> > :%s/\_.*(\_.*);//gc
>
> > thanks
>
> Since \_.* matches _as many as possible_ of anything including a
> linebreak, the above would delete everything in the file until the last
> ); pair, provided that there is at least one ( anywhere before it in the
> file.
>
> How would you formulate your desired search-replace, in plain English?
>
> Best regards,
> Tony.
> --
> Bare feet magnetize sharp metal objects so they point upward from the
> floor -- especially in the dark.

yeah, that's true it's matching the whole file. but the reason i used
it is to
match a new line char. the following are possible c  function
declarations.

type_name fun_name(type_name p1);

type_name
fun_name(type_name p1);

type_name fun_name (type_name p1, type_name p2);
e
the trick is there can be any no.of parameters are no parameters at
all
and there can be a line break anywhere after a valid c token.

I think the regular expression in plain english is
"
any string with, sequence of characters followed by one or more spaces
followed by a "(" and
sequence of characters includeing "," or "_" followed by a ");"

"

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

Reply via email to