Re: Regex guru needed

From: Date: Sat, 13 Nov 2004 17:58:01 +0000
Subject: Re: Regex guru needed
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-34378@lists.php.net to get a copy of this message
Tobias Schlitt wrote:
Hi bertrand Gugger! On 11/13/2004 10:57 AM you wrote:
I think you must catch the whole between the parenthesis, and then split it with spaces as:
That's especially what I wanted to avoid, since having all in 1 regex is much faster than spliting every result again.
Ok, then one solution can work if you limit the number of subpatterns as: $string = "(aaa bbb ccc ddd)"; $regex = '/\('.str_repeat ('(?:([a-z]+)\s*)?', 20).'\)/'; preg_match($regex, $string, $matches); var_dump($matches); Here you catch it in once, but limited to 20. I don't know if you can admit such a limit. Bye bertrand Gugger (toggg)

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