8 月 212015
 

Source: PHP / Javascript 正規表示法 檢測 中文 的表示式 | 微。細節

在Javascript中:

[\u4e00-\u9fa5]

在PHP中此則表示法要改為16進制:

[\x4e00-\x9fa5]

使用以上正規表示法式子 可匹配中文字

為什麼? 請參考

更多表示式範例

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

CAPTCHA Image
Play CAPTCHA Audio
Reload Image