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" Quote Link to comment 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 Quote Link to comment 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++; } Quote Link to comment Share on other sites More sharing options...
wenxi Posted June 15, 2007 Author Share Posted June 15, 2007 anyone to enlighten? Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.