Dušan Novaković wrote:

> Hi guys,
> 
> Does anyone know how to write validation for data witch contains
> letters such as šđčćž (those are Serbian letters)?
> Here is part of my code where it does validation:
> 
> $admins_validation = array('name'      =>
> '/^[[:alnum:][:punct:][:space:]]{1,50}$/',
> 'surname'   => '/^[[:alnum:][:punct:][:space:]]{1,50}$/',
> 'email'        =>
> '/^[A-Za-z0-9]+((\.|-|_)[A-Za-z0-9]+)*...@[a-za-z0-9]+((\.|-
[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/',
> ......
>                                        );
> So, for example if someone enters name Dušan it won't except  it.


I'm pretty certain you only have to set the right locale - that should
make [:alnum:] include the right characters as per the locale.  If you
need to accept other characters (that aren't alphanums in Serbian), you
may need to write your own character classes, but that's easy.

/Per

-- 
Per Jessen, Zürich (11.5°C)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to