模型规则模式

I want my pattern allow: a-z (can have accents), A-Z (can have accents), dash, space and dot. Which way this pattern should be written?

Actual Pattern:

array('name','match', 'not' => true, 'pattern' => '/[^a-zA-Z0-9-\s]/')

The meaning of ^ inside [] is not so what you need is almost the same :-)

/[a-zA-ZÁ-ý0-9-\s]/u

to further elaborate what you might need is /^[a-zA-ZÁ-ý0-9-\s]+$/ which allows the whole string to be only of what's inside the [] and as many as you want (the + is for as many characters as there are)

Try the following regex, i think this is what you're looking for:

$str = 'hjkáÁdfgçÇhj.-hj'; // Matches your criteria
if(preg_match('/^[a-zA-ZÁ-ý\-\. ]+$/', $str))
    echo 'match';
else
    echo 'no match';

can you try this


array('name','match', 'not' => true, 'pattern' => ''^([a-zA-ZÁ-ý\-\. ]+)^'')