Andy Pieters wrote:
> Hi list
> 
> I still fail to understand why regular expressions are causing me such a hard 
> time.
> 
> <snip />

Hi!

Why don't you use 'preg_match'? And why do you use all those character
classes?


This:

<code>
        $subject = 'Nov 22 06:51:36';
        $pattern = '/^(\w{3})\s(\d{2})\s(\d{2}):(\d{2}):(\d{2})/';
        if (preg_match($pattern, $subject, $matches)) {
                print_r($matches);
        }
</code>


nicely prints:

Array
(
    [0] => Nov 22 06:51:36
    [1] => Nov
    [2] => 22
    [3] => 06
    [4] => 51
    [5] => 36
)


Bye
Frank

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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

Reply via email to