PHP verification Chinese expression urgent !!!!!!! -Php Tutorial

Source: Internet
Author: User
PHP verification Chinese expression urgent !!!!!!! Php u9

How to use PHP to verify Chinese letters and numbers,

[\ U4E00-\ u9FA5] can I verify Chinese characters ????? Urgent


Reply to discussion (solution)

[\ X4E00-\ x9FA5]

It should be [\ x4E00-\ x9FCF]
Currently, most of the software supports unicode 6.1.

No. [\ u4E00-\ u9FA5] is used for js regular expressions.

Now that you want to use it like this, we can see that you are using UTF-8 encoding.
In php regular expressions, [\ x {4e00}-\ x {9fa5}] must be written with the u modifier.
However, with the u modifier, \ w contains Chinese characters.

It should be [\ x4E00-\ x9FCF]
Currently, most of the software supports unicode 6.1.

If (ereg ('^ [\ x4E00-\ x9FCF] {1,100} $', 'Hahaha only ')){
Echo "through ";
} Else {
Echo "error ";
}
?>
Or is it wrong,

No. [\ u4E00-\ u9FA5] is used for js regular expressions.

Now that you want to use it like this, we can see that you are using UTF-8 encoding.
In php regular expressions, [\ x {4e00}-\ x {9fa5}] must be written with the u modifier.
However, with the u modifier, \ w contains Chinese characters.

Gb2312 does not understand. js also uses gb2312.

The browser will unify all incoming data into unicode encoding, for simplified Chinese environment is UCS-2
And \ u4E00-\ u9FA5 is the encoding range of the Chinese character UCS-2

The browser will unify all incoming data into unicode encoding, for simplified Chinese environment is UCS-2
And \ u4E00-\ u9FA5 is the encoding range of the Chinese character UCS-2

Yes, you understand.

But you said I couldn't use it in eregi ().

If (eregi ()){
Ecjp 'true ';
}

Thank you !!!

Echo 'true ';

Is ereg supported ????

The ereg series uses POSIX regular expressions.
The preg series uses PCRE regular expressions.
The two are not compatible!

The ereg function Group will be abolished in the near future.

The ereg series uses POSIX regular expressions.
The preg series uses PCRE regular expressions.
The two are not compatible!

The ereg function Group will be abolished in the near future.


Thank you very much !!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.