Re: ereg parse error problem
| From: | Philip Murray | Date: | Tue, 10 Jul 2001 02:24:41 +0000 |
| Subject: | Re: ereg parse error problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-57669@lists.php.net to get a copy of this message | ||
Hi Lara,
The problem isn't with the if(ereg) line, its the line above.
Put a semi-colon at the end of your $string = "..[snip].." line
Cheers
-------------------------------- - -- - - -
Philip Murray - Senior Systems Engineer
webmaster@open2view.com - Open2View.com
http://www.open2view.com
------------- - -- - -
----- Original Message -----
From: "Lara J. Fabans" <lara@lodestone-sw.com>
To: <php-general@lists.php.net>
Sent: Friday, July 13, 2001 1:59 PM
Subject: [PHP] ereg parse error problem
> Hi, friends,
>
> I'm receiving a parse error on the if (ereg... )
> lines of this code. I looked at the online manual and modeled my two
> ereg's after it.
> When I kept getting parse errors, I decided to copy the original from the
> manual into
> my code, and it too received a parse error.
>
> Can someone please help me resolve this?
>
> Thank you,
>
> Lara
>
>
> ---------
> <?php
>
> $string = "<a
> href="http://www.qksrv.net/click-297915-361662"
> target="_top" > <img
>
> src="http://www.123posters.com/images/m-mase01.jpg"
> alt="Mase Necklace"></a> <img
>
> src="http://www.qksrv.net/image-297915-361662"
> height="1" width="1"
> border="0">"
>
> if (ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $string, $regs))
> {
> echo "$regs[3].$regs[2].$regs[1]";
> } else {
> echo "Invalid date format: $date";
> }
>
>
> if (ereg ("img src="(.*)"", $string, $regs))
> {
> echo $regs[1];
> } else
> {
> echo "nope1";
> }
>
> if (eregi("a href="(.*)"", $string, $regs))
> {
> echo $regs[1];
> } else
> {
> echo "nope2";
> }
> ?>
> ---------------------
> Lara J. Fabans
> Lodestone Software, Inc
> lara@lodestone-sw.com
>
>
> --
> 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
>
>