<Original message>
From: Lic. Rodolfo Gonzalez Gonzalez <[EMAIL PROTECTED]>
Date: Mon, Sep 17, 2001 at 05:13:04PM -0500
Message-ID: <[EMAIL PROTECTED]>
Subject: [PHP] Problem: ereg doesn't work o
> Hello,
>
> I have a problem with ereg: following the example from the documentation
> (see the ereg page in the manual), I'm using it to parse a YYYY-MM-DD date
> and get DD-MM-YYYY, but with well formed YYYY-MM-DD it doesn't match!. Is
> this a bug?.
>
> Regards,
> Rodolfo.
>
> php-4.0.8-dev (maybe the problem is due to the "dev", but I'd like to
> confirm it).
</Original message>
<Reply>
It would help if you send the code you're using, 'cause we can't see
what you're doing now. FAFAIK it should just be possible. See the
following example:
--- PHP Code Example ---
<PRE>
<?php
$myDate = "2001-01-31";
$RE = "([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})";
if (ereg ($RE, $myDate, $matches)) {
print ("<H1>Matched!</H1>\n\n");
printf ("Year : %4d\nMonth: %02d\nDay : %02d\n",
(integer)$matches[1],
(integer)$matches[2],
(integer)$matches[3]);
} else {
print ("<H1>Didn't match!</H1>");
}
?>
</PRE>
--- End of PHP Code Example ---
</Reply>
--
* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»»
-- Renze Munnik
-- DataLink BV
--
-- E: [EMAIL PROTECTED]
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
--
-- Stationsplein 82
-- 2011 LM HAARLEM
-- Netherlands
--
-- http://www.datalink.nl
-- ««««««««««««««««««««««««
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]