Hi All,

I don't actually think regexp is fault. But if anyone could explain this or
give me some example code that will extract the attributes and data between
a "fieldset" tag pair I would be appreciated.

Henry

"Henry Grech-Cini" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi All,
>
> function extractFieldsets($subject)
> {
>    $regexp="/<fieldset([^>]*)>[^(<\/fieldset>)]*/i";
>    $replacement;
>    $matches=array();
>
>    preg_match_all($regexp, $subject, $matches);
>
>    return ($matches);
> }
>
> $result=extractFieldsets('test<fieldset attribute="hello">content of
> hello</fieldset><em>blah</em><fieldset
> attribute="goodbye">goodbye</fieldset>');
> echo "<br/>";
> foreach($result as $key=>$string)
> {
>    echo "(".$key.")="."<br/>";
>    foreach($string as $subkey=>$subres)
>     echo "   (".$subkey.")=[".htmlspecialchars($subres)."]<br/>";
>    echo "<br/>";
> }
>
> And it produced;
>
> (0)=
> (0)=[<fieldset attribute="hello">con]
> (1)=[<fieldset attribute="goodbye">goo]
>
> (1)=
> (0)=[ attribute="hello"]
> (1)=[ attribute="goodbye"]
>
> Why did it get three letters after the end of the "fieldset" tag????
>
> "con" and "goo".
>
> Any pointers?

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

Reply via email to