<?php
$name = "Грозный";
if (!preg_match('/^[a-zA-Zа-яА-Я\-\'\ ]{1,20}$/u', $name, $matches)) { $error = "Incorrect name type: name contains invalid characters (valid characters is english or russian letters, hyphens, apostrophes and spaces).";
}
echo $error;
PD9waHAKJG5hbWUgPSAi0JPRgNC+0LfQvdGL0LkiOwoKaWYgKCFwcmVnX21hdGNoKCcvXlthLXpBLVrQsC3Rj9CQLdCvXC1cJ1wgXXsxLDIwfSQvdScsICRuYW1lLCAkbWF0Y2hlcykpIHsKICAgICAgICAgICAgJGVycm9yID0gIkluY29ycmVjdCBuYW1lIHR5cGU6IG5hbWUgY29udGFpbnMgaW52YWxpZCBjaGFyYWN0ZXJzICh2YWxpZCBjaGFyYWN0ZXJzIGlzIGVuZ2xpc2ggb3IgcnVzc2lhbiBsZXR0ZXJzLCBoeXBoZW5zLCBhcG9zdHJvcGhlcyBhbmQgc3BhY2VzKS4iOwp9CgplY2hvICRlcnJvcjs=