Hi again, I have function using regular expression in php, to read URL address and process it, the sample of URl address is like this : mail1.plasa.com --------------> the result -->mail1.plasa.com mail.yahoo.com --------------> the result -->mail.yahoo.com us.f416.mail.yahoo.com -------> the result -->mail1.yahoo.com login.mail.eudoramail.com ----> the result -->mail1.mail.eudoramail.com images.google.com ------------> the result -->google.com us.i1.yimg.com ---------------> the result -->yimg.com 212.213.255.72 ---------------> the result -->212.213.255.72 mail.telkom.net --------------> the result -->mail.telkom.net May be somthing wrong, when i input the url "mail.telkom.net" or "mail1.plasa.com" the result not like i want it, may be you can help me to check what's going on. the function is like this : function url_address($url){ $pattern1 = "/[0-9]$/"; // to check if the url is IP address $pattern2 = "(mail|mail1)"; // to check if the url have string mail or mail1 if (ereg($pattern2, $url)){ // take URL address if the url address is mail.yahoo.com or mail.hotmail.com or mail1.plasa.com $www_url = ereg ("([[:alnum:]]+)\.([[:alnum:]]+)\.([[:alnum:]]+)\.([[:alnum:]]+)\.(com|net|org|edu|mil|gov|gob|info|tv|biz|dk|za)", $url,$regs); echo "Alamat URL Asli $url<br>"; echo "array ke 0 $regs[0]<br>"; echo "array ke 1 $regs[1]<br>"; echo "array ke 2 $regs[2]<br>"; echo "array ke 3 $regs[3]<br>"; echo "array ke 4 $regs[0]<br>"; echo "array ke 5 $regs[1]<br>"; $fix_url="$regs[3].$regs[4].$regs[5]"; } elseif(preg_match($pattern1, $url)){ // take the URL address if the url address is IP address (ex; 122.123.123.123) echo "Alamat URL Asli $url<br>"; $fix_url=$url; } else{ // take URL address if the url address is www.XXXX.com|net|org|edu|mil|gov|gob|info|tv|biz $www_url = ereg("^(www)\.([[:alnum:]]+)\.([[:alnum:]]+)", $url, $regs); if ($www_url): echo "Alamat URL Asli $url<br>"; $fix_url="$regs[2].$regs[3]";// www dibuang dan diambil nama.domain else: // take URL address if the url address is www.YYYY.XXXX.com|net|org|edu|mil|gov|gob|info|tv|biz echo "Alamat URL Asli $url<br>"; $www_url = ereg("([[:alnum:]]+)\.(com|net|org|edu|mil|gov|gob|info|tv|biz|dk|za)", $url, $regs); $fix_url="$regs[0]"; endif; } return $fix_url; } Thanks for your help idur --------------------------------- Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes