wenxi Posted June 14, 2007 Share Posted June 14, 2007 just like to ask if this function is workabkle? if (!ereg("^[a-zA-Z0-9\]{3,50}$", $_REQUEST['tfaddress'])) { $adderr = "* Please Enter a valid address name that only contain letter, space and -"; $error++; } for examp my address is "1234 singapore 59 orchard boulevard" Link to comment https://forums.phpfreaks.com/topic/55592-valitdation-address/ Share on other sites More sharing options...
Full-Demon Posted June 14, 2007 Share Posted June 14, 2007 You have a '\' infront of the ']'. Not correct. Should be a space in between I guess. You sure some adresses arent longer than 50? Btw, I should seperate streetname (with or without house number (can be seperate)), city, province, country, postal code FD Link to comment https://forums.phpfreaks.com/topic/55592-valitdation-address/#findComment-274789 Share on other sites More sharing options...
wenxi Posted June 14, 2007 Author Share Posted June 14, 2007 so what is the code like? If i want to chunk them all up? if (!ereg("^[a-zA-Z0-9-]{3,100}$", $_REQUEST['tfaddress'])) { $adderr = "* Please Enter a valid address name that only contain letter, space and -"; $error++; } Link to comment https://forums.phpfreaks.com/topic/55592-valitdation-address/#findComment-274981 Share on other sites More sharing options...
wenxi Posted June 15, 2007 Author Share Posted June 15, 2007 anyone to enlighten? Link to comment https://forums.phpfreaks.com/topic/55592-valitdation-address/#findComment-275136 Share on other sites More sharing options...
neel_basu Posted June 19, 2007 Share Posted June 19, 2007 If you wanna validate Urls You can use this if (preg_match('/(?P<protocol>\w+):\/\/(?P<domain>[-A-Z0-9.]+)(?P<file>\/[-A-Z0-9+&@#\/%=~_|!:,.;]*)?(?P<parameters>\\?[-A-Z0-9+&@#\/%=~_|!:,.;]*)?/i', $url, $m)) { print_r($m);//Matched } else { //Not Matched } Hope it helps. Link to comment https://forums.phpfreaks.com/topic/55592-valitdation-address/#findComment-277408 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.