Re: Getting Results from function; snickers != buttery !
| From: | Kevin Leavell | Date: | Thu, 16 Nov 2000 06:41:59 +0000 |
| Subject: | Re: Getting Results from function; snickers != buttery ! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25634@lists.php.net to get a copy of this message | ||
Thanks for working with me here but I need a little more help.
$value=ereg_replace('[^>]*value="([^"]+)">','\\1',$string);
Makes snickers = goodbaduglybuttery
I need
snickers = good
marsbar = bad
peppermintpatty = ugly
butterfinger = buttery
Here is the original code:
$string='<input type="hidden" name="snickers" value="good">
<input type="hidden" name="marsbar" value="bad">
<input type="hidden" name="peppermintpatty" value="ugly">
<input type="hidden" name="butterfinger" value="buttery">';
$key=ereg_replace('<input type="hidden"
name="([^"]+)".*','\\1',$string);
$value=ereg_replace('.*value="([^"]+)">','\\1',$string);
$$key=$value;
print $snickers;
Thanks again,
Kevin
BTW - thanks for the tip on monospace fonts. Now everyones sig will look
much better :)
----- Original Message -----
From: Ignacio Vazquez-Abrams <ignacio@openservices.net>
To: Kevin Leavell <k@bigsky.net>
Cc: <php-general@lists.php.net>
Sent: Wednesday, November 15, 2000 11:26 PM
Subject: Re: [PHP] Getting Results from function; snickers != buttery !
> On Wed, 15 Nov 2000, Kevin Leavell wrote:
>
> > I am not sure exactly what you mean here: What is "[^>]*" supposed to
> > replace?
> >
> > > >
> > > > $value=ereg_replace('.*value="([^"]+)">','\\1',$string);
> > > ^^
> > >
> > > Whoops. Try "[^>]*" instead.
> > >
> > > --
> > > Ignacio Vazquez-Abrams <ignacio@openservices.net>
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > > For additional commands, e-mail: php-general-help@lists.php.net
> > > To contact the list administrators, e-mail:
php-list-admin@lists.php.net
> > >
> >
>
> Oh, you're using Outlook. If you use a monospaced font you'll see
> clearly. But it's the ".*" right at the beginning of the RE.
>
> --
> Ignacio Vazquez-Abrams <ignacio@openservices.net>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>