Hello,

I have this code which basically grabs the date after several variations of the text last updated: so I can store it into mysql date format in the DB.

The problem is its not very effecient when it comes to the dates since different websites have them formatted differently.

Here is the current code:

PHP Code:
            $upos strpos($whois['data'], "updated date:");
            if (!(
$upos === false)) {
                
$upddate substr($whois['data'], $upos+1411);
            } else {
                
$upos2 strpos($whois['data'], "record last updated on");
                if (!(
$upos2 === false)) {
                    
$upddate substr($whois['data'], $upos2+2411);
                } else {
                    
$upos3 strpos($whois['data'], "last updated on:");
                    if (!(
$upos3 === false)) {
                        
$upddate substr($whois['data'], $upos3+1612);
                    } else {
                        
$upos4 strpos($whois['data'], "last updated on");
                        if (!(
$upos4 === false)) {
                            
$upddate substr($whois['data'], $upos4+1611);
                        } else {
                            
$upddate "";
                        }
                    }
                }
            } 
90% of this is repitition. Maybe I could run it thru 4 regex instead of this way because I have the following problems:

The dates are all formatted differently so the 11 characters doesnt always catch all the dates and cuts some info off. I run them thru strtotime but that doesnt always work because the date is cut off.

Sometimes the dates are 12-jan-2006 or sat, jan 12, 2006 or jan 12, 2006 so on and so forth.

Is how I am doing this the best way or would using multiple regex be better for this, if it is can you show me an example of one that would work?