A while back I used ereg() in some of my functions, but from php 5.3 ereg() is deprecated, so I need to rewrite them to preg_match(). However, I am not to good with regular expressions in preg_match()-style. Hoping for your help:

PHP Code:
ereg("^[a-z0-9]+$"$name);
// I think I rewrote it correctly to
preg_match("/^[a-z0-9]+$/"$name);
// and I guess the following should just be done in the same manner
ereg("^[A-Z][a-z]{2}$"$iso_code)
ereg('^[0-9]{2}-[0-9]{2}-[0-9]{4}$'$duration)
ereg('^([0-9]{1,2}) month$'$duration$params
A more complicated story - where I have no clue where to start when using preg_match():

PHP Code:
    // @todo this should be rewrote to preg_match
    // function converts a date to iso-db-format
    
function convert2db($default_year "")
    {
        
$d "([0-3]?[0-9])";
        
$m "([0-1]?[0-9])";
        
$y "([0-9][0-9][0-9][0-9]|[0-9]?[0-9])";
        
$s "(-|\.|/| )";

        if (
$default_year == "") {
            
$default_year date("Y");
        }

        if (
ereg("/^".$d.$s.$m.$s.$y."$/"$this->date$parts)) {
            
// true
        
} elseif (ereg("/^".$d.$s.$m."$/"$this->date$parts)) {
            
$parts[5] = $default_year;
            
// true
        
} else {
            return 
false;
        }

        
$this->date $parts[5]."-".$parts[3]."-".$parts[1];
        return 
true;
    } 
Thanks in advance for your help.