Thanks Sven, You are quite right with your "some probs" comment.
Do you know what the the switch is that catches only the least result? I now get (0)= (0)=[<fieldset attribute="hello"><legend>hello legend</legend>content of hello</fieldset><em>blah</em><fieldset attribute="goodbye">goodbye</fieldset>] (1)= (0)=[ attribute="hello"] (2)= (0)=[<legend>hello legend</legend>content of hello</fieldset><em>blah</em><fieldset attribute="goodbye">goodbye] as we can see the second fieldset is included in that which is between the fieldset tags! :-( Thanks everyone for you help including Mike (with the post out of chain). Henry "Sven" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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