我正在使用正則表達式來查看字符串中是否存在單個非拉丁字符。如何使用正則表達式找到一個非拉丁字符的單個事件?
$latin_check = '/[\x{0030}-\x{007f}]/u'; //This is looking for only latin characters
if(preg_match($latin_check, $_POST['full_name'])) {
$error = true;
}
這應該檢查是否至少存在一個不是拉丁字符的字符。如果它沒有找到至少一個非拉丁字符,那麼它應該將$ error設置爲true。
我想我的邏輯可能是錯誤的。如何在php中使用正則表達式查找單個非拉丁字符的發生?
一眼看來,這對我來說很好。看起來preg_match是什麼意思。有關它不起作用? – 2010-07-14 04:02:40
請參閱http://stackoverflow.com/questions/3411566/how-can-i-detect-non-western-characters/3411589#3411589 – Artefacto 2010-08-09 22:56:19