martinlabuschin
9/7/2017 - 9:12 AM

Comment text validator

protected $wrongFormats = array(
        array (
            'pattern'=> '/^(.){0,2}$/u',
            'message' => 'ratingform.validators.provide_valid_comment'
        ), //order id should be minimum 3 chars long
        array (
            'pattern' => '/^([^a-zA-Z\p{L}]){2,}+$/u',
            'message' => 'ratingform.validators.provide_valid_comment'
        ),//matches specials chars repeat longer 1: #!.,-?[]^$'
        array (
            'pattern' => '/^([\p{L}])\\1+$/u',
            'message' => 'ratingform.validators.comment_blacklist'
        ), //matches string containing only repeating character
        array(
            'pattern' => '/^(?:[^\p{L}]*[\p{L}]){0,2}[^\p{L}]*$/u',
            'message' => 'ratingform.validators.provide_valid_comment'
        )// matches words that are 3 chars long containing at least one digit
    );