简体   繁体   中英

How to allow textbox only to accept Japan characters, number and word in PHP?

I try to search about RegEx and find some answer. But it isn't full. Example:

Only accept Japan character:

(?:\xEF\xBD[\xA1-\xBF]|\xEF\xBE[\x80-\x9F])|[\x20-\x7E]

Only accept number and word:

[^a-zA-Z0-9]

But I don't incorporate together. Please help!

Update answer

/^[\p{Katakana}\p{Hiragana}\p{Han}a-zA-Z0-9]+$/iu

您可以在字符类中组合以下Unicode属性和字母数字集。

/^[\p{Katakana}\p{Hiragana}\p{Han}a-z0-9]+$/iu

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM