07-03-2016, 06:57 AM
I am using library of Form Validation in CodeIgniter.
Below config try to include all Number, English words, Chinese words and space. But it's not work.
However, if I deduce '\u4e00-\u9fa5', it's work for English words.
Somebody tell me that 'uxxxx' is not work in PCRE. They suggest me that "/\A[a-zA-Z0-9\s\p{Han}]+\z/".
I test "/\A[a-zA-Z0-9\s\p{Han}]+\z/" in online test website https://regex101.com/r/bC2iK2/1. It's work.
However, it is not work in my website.
Below config try to include all Number, English words, Chinese words and space. But it's not work.
Code:
$config = array(
array(
'field' => 'keywords',
'label' => 'keywords',
'rules' => 'regex_match[/[a-zA-Z0-9 \u4e00-\u9fa5]+$/]'
)
);
However, if I deduce '\u4e00-\u9fa5', it's work for English words.
Code:
$config = array(
array(
'field' => 'keywords',
'label' => 'keywords',
'rules' => 'regex_match[/[a-zA-Z0-9 ]+$/]'
)
);
Somebody tell me that 'uxxxx' is not work in PCRE. They suggest me that "/\A[a-zA-Z0-9\s\p{Han}]+\z/".
I test "/\A[a-zA-Z0-9\s\p{Han}]+\z/" in online test website https://regex101.com/r/bC2iK2/1. It's work.
However, it is not work in my website.
Code:
$config = array(
array(
'field' => 'keywords',
'label' => 'keywords',
'rules' => 'regex_match[/\A[a-zA-Z0-9\s\p{Han}]+\z/]'
)
);