About PHP regular matching Chinese

PHPz
Release: 2023-04-09 15:30:01
forward
5335 people have browsed it

About PHP regular matching Chinese

Recommendation: "PHP Video Tutorial"

PHP regular matching Chinese

@author: CooperZhang

Regular matching character set [{4e00}-\x{9fa5}]

Note:

  • U should be added at the end of the regular expression, in the form: /^...$/u

1. The match contains all Chinese

/^[{4e00}-\x{9fa5}]+$/u
Copy after login

2. The match contains Chinese

/[{4e00}-\x{9fa5}]+/u
Copy after login

3. Match Chinese and English (including symbols _)

/[\w{4e00}-\x{9fa5}]+/u
Copy after login

The above is the detailed content of About PHP regular matching Chinese. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!