2011-01-30 92 views

回答

4
$valid = preg_match('/[\pL\pN]/U', $str); 

$strs = array(
    'привет', // TRUE 
    'hello', // TRUE 
    '42',  // TRUE 
    '%'  // FALSE 
); 

Check it

3
$contains = preg_match('~[\da-z]~i', $str) 
+1

您應該添加`/ i`使其不區分大小寫。否則,它不適用於大寫字母。 – 2011-01-30 13:54:12

+0

@Felix Kling:肯定。 – zerkms 2011-01-30 13:55:28

相關問題