On Fri, 10 Sep 2004 11:58:58 +0100, in php.general [EMAIL PROTECTED] (Abdul-Wahid Paterson) wrote:
>> I was wondering if any classes/functions could help me with this little >> challenge, (im hopeless at regex ;-) >> >> <input type="hidden" name="id" value="593" /> > >No easy way of doing it, regex somthing like: > >$id = preg_replace("/.*<input.*name=\"id\" value=\"[0-9]+\" \/>/", $1, $string); How about just using an xml-based function? Much cleaner, doesn't require name-attribute to be present before value-attribute. <?php $string = '<input type="hidden" name="id" value="593" />'; $x = xml_parser_create(); xml_parse_into_struct($x,$string,$array); print $array[0]['attributes']['VALUE']; // or, out of curiousity: var_dump($array); ?> (and why preg_replace? $1 wouldn't even be set since no capturing parenthesises are used) -- - Peter Brodersen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php