enxaneta Posted October 24, 2012 Share Posted October 24, 2012 Hi everybody, I’m not very good with regex, and I live in Catalunya ( a language full with diacritics). An address here may look like this: Carrer d’Antoni Toldrà s/n 1º,2ª. For the checkout.php I’ve rewritten Larry’s code like so: if (preg_match ("/^[0-9'.,\/\p{L}_\s]{5,100}$/u", $_POST['address'])) { $address = addslashes($_POST['address']); } else { $reg_errors['address'] = 'Sisplau, introdueixi una adreça d'enviament!'; } Although this will work in my computer (PC, PHP 5.3.1) it will fail when I’m going life (LINUX, PHP 5.2.17) Is it anybody there able to tell me what is wrong with my regex? Link to comment Share on other sites More sharing options...
HartleySan Posted October 25, 2012 Share Posted October 25, 2012 Does this answer your question? http://stackoverflow.com/questions/8228140/php-regex-validate-letters-and-spanish-accent I don't have experience with regexes for Spanish, but I believe you can search for all Latin characters (including accented ones) using \p{L}. If that doesn't work, you can use \x and the actual Unicode code sets for all the characters you need to search for. Link to comment Share on other sites More sharing options...
Recommended Posts