检查 PHP 代码:
unset($str1,$str2,$str3,$str4,$str5,$str6,$str7);
$str1 = '%100';
$str2 = '%100\%';
$str3 = "100\\\\%";
$str4 = "%100\\%%";
$str5 = '100\%';
$str6 = "100\\\\\\\\%";
$str7 = "100\\\\\\%";
$str8 = "100\\\\\\\\\\\\%";
$str9 = "100\\\\\\\\\\\\\\%";
$reg_exp= '/^%|[^\x5C]%|[^\x5C](\x5C\x5C)+%/';
echo $str1.' = '.preg_match($reg_exp, $str1).'<br />';
echo $str2.' = '.preg_match($reg_exp, $str2).'<br />';
echo $str3.' = '.preg_match($reg_exp, $str3).'<br />';
echo $str4.' = '.preg_match($reg_exp, $str4).'<br />';
echo $str5.' = '.preg_match($reg_exp, $str5).'<br />';
echo $str6.' = '.preg_match($reg_exp, $str6).'<br />';
echo $str7.' = '.preg_match($reg_exp, $str7).'<br />';
echo $str8.' = '.preg_match($reg_exp, $str8).'<br />';
echo $str9.' = '.preg_match($reg_exp, $str9).'<br />';
http://ideone.com/Bgq5bV