preg_match() and japanese characters
Posted: Fri Dec 03, 2010 2:13 pm
This is my function:
And whenever any data is being sent I got this error:
Code: Select all
function protect_content($var) {
$specialChars = preg_quote('!@#$%^&*()/*-+=[]{};:\'",.<>?', '/');
$pattern = '/
^[
\w\s
' . $specialChars . '
\x30A0-\x3oFF
\x3040-\x309F
\x4E00-\x9FBF
\x3000-\x303F
]*$
/xu';
if (!preg_match($pattern, $var)) { return false; } else {
return true;
}
}
Warning: preg_match() [function.preg-match]: Compilation failed: range out of order in character class at offset 82 in C:\Program Files\(path)\functions_class.php on line 60