Ask a Question related to PHP Development, Design and Development.
-
Jim Lucas #1
Re: [PHP] Regular expression question
well, first off '>' should not be allowed as a value of an attr="" pair
anyways.
You should convert it to > or <
this will solve that problem.
Jim Lucas
----- Original Message -----
From: "Dan Phiffer" <dan@phiffer.org>
To: <php-general@lists.php.net>
Sent: Monday, August 04, 2003 4:03 PM
Subject: [PHP] Regular expression question
character> 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> ">":
>
> 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
>
>Jim Lucas Guest
-
cfform regular expression question
Hey, Quick question for you. I am trying to use cfform to validate for an email address. How do I do? <cfinput type="text" name="cstreet2" ... -
Regular Expression Question
Hello, is it possible to make a regular expression match for the following situation: I have a string, looking like 'foobarbarbar'. I don't... -
Regular expression newbie question
How do I write "not" in regular expression? I am new to reg exp. I want to check the string which does not contain "http://" I wrote ... -
Regular Expression - BackReferences Question
I have a file containing the following URL in it http://www.somesite.com/folder/1.gif Now, everyday I need to run a script so that 1.gif in the... -
question abour a simple regular expression...
Hi, With the sentence : "Bordeaux est au bord de l'eau" How to do to underline, for instance, the word "eau" ? without underlining the... -
Dan Phiffer #2
Re: [PHP] Regular expression question
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" <phplist@zonedzero.net> wrote in message
news:001301c35ae3$0db0ea40$dd64a8c0@xp...> well, first off '>' should not be allowed as a value of an attr="" pair
> anyways.
>
> You should convert it to > or <
>
> this will solve that problem.
>
> Jim Lucas
> ----- Original Message -----
> From: "Dan Phiffer" <dan@phiffer.org>
> To: <php-general@lists.php.net>
> Sent: Monday, August 04, 2003 4:03 PM
> Subject: [PHP] Regular expression question
>
>> character> > 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>> > ">":
> >
> > 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
> >
> >
Dan Phiffer Guest



Reply With Quote

