Regular expression question

From: Date: Mon, 04 Aug 2003 23:03:35 +0000
Subject: Regular expression question
Groups: php.general 
Request: Send a blank email to php-general+get-158210@lists.php.net to get a copy of this message
So I want to grab the attributes out of an HTML element. The following works, except in the case that the attribute's value includes the character ">": if (preg_match_all("/<tag([^>]*)>/i", $subject, $matches)) print_r($matches); A $subject of "<tag attr=\"value\">" gives: Array ( [0] => Array ( [0] => ) [1] => Array ( [0] => attr="value" ) ) A $subject of "<tag attr=\">\">" gives: Array ( [0] => Array ( [0] => Thanks for any help, -Dan

« previous php.general (#158210) next »