Actually, this is for a general purpose templating that might use < and > or
[ and ] (i.e. [element attribute="value"]), but I suppose the same character
entity requirement could be applied to other "boundary characters." Somehow
it didn't occur to me.

Thanks for the response,
-Dan

"Jim Lucas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> well, first off '>' should not be allowed as a value of an attr="" pair
> anyways.
>
> You should convert it to &gt; or &lt;
>
> this will solve that problem.
>
> Jim Lucas
> ----- Original Message -----
> From: "Dan Phiffer" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, August 04, 2003 4:03 PM
> Subject: [PHP] Regular expression question
>
>
> > 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
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>



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

Reply via email to