我必须为 full_name 字段使用什么 pregmach 规则?
我希望用户只输入字符而不是 html 或 php 代码值以及
我可以使用的 3 到 11 个字符之间的空格:
<?php
if (preg_match("%^[A-Za-z0-9-_]{3,10}$%", $_REQUEST['usr'])) {
//do something like
mysql_query('insert into user(name) values(this field)');
//damn what is this for: It does not meet our quality standards.!!!
//i must insert more code? i dont have ! let me go !
}
else{
//do something else!
die('get out !:D');
}
?>
但是这个用户不能输入像“مسیحارسطوئی”
这样的UTF-8字符,那么我必须对UTF-8使用什么preg_match规则?
或者我可以使用什么其他代码,比如 preg_match ?
我希望用户可以
在 3 到 10 个字符之间插入不是 <>{}[] 或 $%^&* 的字符!!!谢谢