I want check if text contain cyrillic characters and if contain set max length for field max 60 characters else set max length 170 characters. I tried next code:
var _this = this;
var value = el.getValue();
if (value.match(/[^а-яА-ЯёЁ\n0-9,.!():;@&#%+_/\'\" -]/ig) === null) {
_this.getViewModel().set('myMaxLength', 60);
_this.getViewModel().set('length', value.length);
} else if (value.match(/[^a-zA-Z\n0-9,.!():;@&#%+_/\'\" -]/ig) === null) {
_this.getViewModel().set('myMaxLength', 170);
_this.getViewModel().set('length', value.length);
} else {
_this.getViewModel().set('myMaxLength', 60);
_this.getViewModel().set('length', value.length);
}
My code not work correctly, because when text on France max length sets 60 characters, but need 170. How I can allow all character except cyrillic.