Rule Validator Model For Multilingual Letters


I want a Model validator for name/surname field of Model,


array('username', 'match', 'pattern'=>'/^([a-z0-9])+$/'),

Permits only english characters.

I want the validator to permit all national languages (like Russian, Chinese, Greece etc)

Is there a validator or secured pattern to achieve that?


Interesting one! try


Thanks bettor

But seems to not work properly,

for example it works for character κ (kappa) but not works for α (alpha)

Maybe have to make an exclusive pattern?

Can I have a list of code with all special characters in utf-8, and how it should be the pattern ?

but this one works properly! (both Greek and English)

array('person_name', 'match', 'pattern'=>'/^[^[:punct:]]+$/'),

Bettor or anyone else has any suggestion or opinion please share it!

If it works it should be fine. Also test with some of the umlaut chars from the German alphabet: ä ö ü ß


I checked In my home with different national characters like greek,german, chinese, arabic

Ελλάδα ä ö ü ß English 漢語 ل٥غلثهبةك

It works by this pattern

array('attr1', 'match', 'pattern' => '/^[^\'\/~`\!@#\$%\^&\*\(\)_\-\+=\{\}\[\]\|;:"\<\>,\.\?\\\]+$/'),

the strange thing, at the company that I work I tested for greek-english and works with

array('person_name', 'match', 'pattern'=>'/^[^[:punct:]]+$/'),

But I tested at my home and it is not work!! what is wrong!?

I think the very above pattern works in any case.