php regular Chinese

WBOY
Release: 2016-08-04 09:19:49
Original
1081 people have browsed it

php matches Chinese with regular expression

<code>1.用.+ 可以匹配到一个以上的中文吗?
2.用这样的 '/你好,哈哈/' 去匹配中文会不会出现问题?</code>
Copy after login
Copy after login

Because I don’t know much about regular expressions, I would like to ask if there will be any encoding problems when matching regular expressions with Chinese characters?

Reply content:

php matches Chinese with regular expression

<code>1.用.+ 可以匹配到一个以上的中文吗?
2.用这样的 '/你好,哈哈/' 去匹配中文会不会出现问题?</code>
Copy after login
Copy after login

Because I don’t know much about regular expressions, I would like to ask if there will be any encoding problems when matching regular expressions with Chinese characters?

  1. can match

  2. Using /Hello, haha/, this will only match /Hello, haha/this.... because the two slashes before and after will be treated as normal content..

There are also problems with Chinese encoding. Just like if I use unicode characters to match Chinese with ordinary str type content in Python, it won’t match. I just need to cache the unicode encoding of the content

Related labels:
php
source:php.cn
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