我有一个功能
public function valid_city_state($data)
{
$data = trim($data);
if(!$data)
{
return TRUE;
}
$valid = preg_match("/^[a-zA-Z\u0080-\u024F\s\/\-\)\(\`\.\"\']+$/",trim($data));
if(!$valid)
{
$this->form_validation->set_message('valid_city_state', 'Please enter a valid %s.');
return FALSE;
}
else
{
return TRUE;
}
}
它有正则表达式
$valid = preg_match("/^[a-zA-Z\u0080-\u024F\s\/\-\)\(\`\.\"\']+$/",trim($data));
执行时出现以下错误
A PHP Error was encountered
Severity: Warning
Message: preg_match() [function.preg-match]: Compilation failed: PCRE does not support \L, \l, \N{name}, \U, or \u at offset 9
Filename: home/auth.php
Line Number: 1632
看了一些例子,但无法得到需要的东西
php - 正则表达式 - PCRE 不支持 \L, \l, \N, \P,
http://www.sitepoint.com/forums/showthread.php?748713-Preg-match-with-php-PCRE-error
请帮忙 。提前致谢 。
更新
这个正则表达式在 javascript 中工作正常