search and callback with preg

From: Date: Tue, 05 Nov 2002 17:01:16 +0000
Subject: search and callback with preg
Groups: php.general 
Request: Send a blank email to php-general+get-122796@lists.php.net to get a copy of this message
Hi I'm building an parser for my own project called vibrant. i need a file to be parsed, but I can't seem to get the right expression please please help; $src = " <vibrant application="application 1"> 1<vibrant application="application 2"> 2<br> </vibrant> </vibrant> <vibrant application="application 3"> 3 </vibrant> "; preg_match_all( "/(<(vibrant+)[^>]*>)(.*)(<\/vibrant>)/i", $src, $matches ); print_r($matches); what i need is a good solution to the greedy problem. when greedy it gets the wrong closing tag and therefore the wrong content. When greedy is disabled I get the first close tag which actually belongs to the second opening tag I in the dark here, help is apriciated very much. so the vibrant tags in the contentpart do not need to be found, since they will be iterated the next time round. thx thx

« previous php.general (#122796) next »