Re: Regex guru needed
| From: | Frederic Poeydomenge | Date: | Sat, 13 Nov 2004 16:39:47 +0000 |
| Subject: | Re: Regex guru needed | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-34374@lists.php.net to get a copy of this message | ||
Hi Tobias,
> I try creating a regex which extracts all function/method prototypes
> from a PHP file. So far, I went pretty well, besides one problem.
> ...
> Any ideas?
I think the following code is a working solution for your problem :
$str = "(aaa bbb ccc ddd)";
$splited = preg_split('/ |\(|\)/', $str, -1, PREG_SPLIT_NO_EMPTY);
var_dump($splited);
=>
array(4) {
[0]=>
string(3) "aaa"
[1]=>
string(3) "bbb"
[2]=>
string(3) "ccc"
[3]=>
string(3) "ddd"
}
Regards,
--
Frederic Poeydomenge \|||/
Web : http://fpoeydomenge.free.fr/ (o o)
E-mail : fpoeydomenge@free.fr -------oOO-(_)-OOo---
GnuPG : http://fpoeydomenge.free.fr/public-key.asc
Attachment: [application/pgp-signature]
Attachment: [application/pgp-signature]