Hasanuddin Tamir wrote:

> On Tue, 26 Jun 2001, Yvonne Murphy <[EMAIL PROTECTED]> wrote,
>
> <snip>
>
> >  if ($mymatch =~  m/\'(.+)\;/gis) { #matches anything between the single
>                          ^^
> <snip>
> >
> >
> > But the problem occurs when I add this into a bigger code segment, it
> > just goes crazy! And seems to match te complete opposite.
> >
> > And ideas?
>
> You seem to be bitten by the greedy match.  By default, the quantifiers
> (such as + and *) will match as many as possible.  You need the ? to
> suppress the greed behaviour.  This ? is different form the ? used to
> optional unit.
>
>     $_ = "'first; second;";
>     print $1, "\n" if /'(.+);/;   # first; second
>     print $1, "\n" if /'(.+?);/;  # first
>
> Btw, /gis seems redundant to me.  So do the backslases.
>
> hth;
>
> __END__
> --
> s::a::n->http(www.trabas.com)

The data in the functions2.log file takes the following format:

'fdecls' => ARRAY(0x80e53c0)
   0  'int fibonacci(int degree);'
   1  'int towerOfHanoiMoves(int numOfDisks);'
   2  'void xyzzy(char* easterEgg);'
   3  'char* interesting();'
   4  'extern void  system_alarm_run(int *alarm);'
   5  'extern void  system_alarm_pause(int *alarm);'
   6  'extern int *system_timer_new( unsigned long tag );'
   7  'extern int *system_timer_callback_new( void (*callback_function)
          (unsigned long tag), unsigned long tag );'
   8  'int     system_timer_start( int * timer, long time );'
   9  'long    system_timer_pause( int * timer );'
   10  'int     system_timer_stop( int * timer );'
   11  'int     system_timer_del( int * timer );'

And I need to remove the actual function declaration and assign each of
the words to variables, such as, $return_type, $function_name, etc.

Is that any clearer?

Thanks,
YM

Reply via email to