Henry Grech-Cini schrieb:
...
$regexp="/<fieldset([^>]*)>[^(<\/fieldset>)]*/i";
...
$result=extractFieldsets('test<fieldset attribute="hello">content of
hello</fieldset><em>blah</em><fieldset
attribute="goodbye">goodbye</fieldset>');
...
And it produced;
(0)=
(0)=[<fieldset attribute="hello">con]
(1)=[<fieldset attribute="goodbye">goo]
(1)=
(0)=[ attribute="hello"]
(1)=[ attribute="goodbye"]

hi,


as it is defined in regex-spec: a '^' inside a char-group '[...]' defines all chars, that aren't allowed, and not a string!

so the first 't' of 'content' and the 'd' of 'goodbye' don't match your regex anymore.

a start for a solution could be:

<?php
    $rx = '/<fieldset[^>]*>(.*)<\/fieldset>/i';
?>

if you want to take care of your fieldset-attribs in your result, you can set your brackets again: ([^>]*)

some probs i can think of are nested fieldsets inside fieldsets (don't know by head, if this is allowed by w3). and another prob: is that you don't catch multiple fieldsets after another. i think there is a switch, that catches only the least result.

hth SVEN

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to