Re: Regex guru needed

From: Date: Mon, 15 Nov 2004 09:11:23 +0000
Subject: Re: Regex guru needed
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-34387@lists.php.net to get a copy of this message
I wonder if you could use the tokenizer extension to achieve this? "Tobias Schlitt" <tobias@schlitt.info> wrote in message news:41961DE4.1080601@schlitt.info... > Hi all! > > I try creating a regex which extracts all function/method prototypes from > a PHP file. So far, I went pretty well, besides one problem. The regex > below works pretty well, but only the last parameter of a function > declaration is extracted. Maybe someone can give me a hint how to get all > parameters (into seperate array elements)? > > To show you, what I mean I wrote a little example which shows the same > bahavior with much fewer code: > > <snip title="code"> > $string = "(aaa bbb ccc ddd)"; > > $regex = "/\((?: > ([a-z]+)\s* > )+\)/x"; > > preg_match($regex, $string, $matches); > > var_dump($matches); > </snip> > > <snip title="result"> > array(2) { > [0]=> > string(17) "(aaa bbb ccc ddd)" > [1]=> > string(3) "ddd" > } > </snip> > > Any ideas? > > Regards, > Toby > -- > Tobias Schlitt GPG Key: 0xA6529579 > a passion for php > http://www.schlitt.info > Like to say "thank you"? - > http://pear.php.net/wishlist.php/toby

« previous php.pear.dev (#34387) next »