Of course, the new database is done properly, and form have all fields, and they are properly validated before insert. I just want to transfer the old data to the new database. I have made a fairly good solution now: [code] <?php $address = "Thestreet 123 , 3131 MYPLACE,COUNTRY"; //formatting messed up on purpose $cutLinefeeds = str_replace ( "\r\n", "", $address); $cutCommas = str_replace ( ",", " ", $cutLinefeeds); $cutSpaces = preg_replace('/\s\s+/', ' ', $cutCommas); preg_match('/[0-9][0-9][0-9][0-9]/i',$cutSpaces, $zip); $theZip = $zip[0]; if(!empty($theZip)) { $adressArray = explode(" ", $cutSpaces); $index = array_search($theZip, $adressArray); $city = $adressArray[$index+1]; $streetArray = array_slice($adressArray, 0, $index); $street = trim(implode(" ", $streetArray)); } else $street = $cutSpaces; echo "Street: $street<br>"; echo "Zip: $theZip<br>"; echo "City: $city<br>"; ?>[/code] Comments: - First i'm removing linefeeds and commas, so that every part have only a space between. - I assume that city will always come right after the zip. - I assume that if theres anything after city, it'is garbage. Usually theres nothing, but theres something it's always(?) country. Since all my customers are from same country, I don't need it. The most obvious bug i find now, is that if the street address also contains 4 digits, it will assume that is the zip. Does anyone have any other suggestions/improvements? Thanks!