Home  >  Article  >  Backend Development  >  Detailed explanation of php preg_match matching examples of languages ​​in different countries

Detailed explanation of php preg_match matching examples of languages ​​in different countries

墨辰丷
墨辰丷Original
2018-05-29 09:54:441549browse

This article mainly introduces relevant information about php preg_match matching examples of languages ​​in different countries. Friends in need can refer to

php preg_match matching examples of languages ​​​​in different countries

Regular: [\S]{2,32}

Filtering works

In PHP:

<?php
var_dump( preg_match("/[\S\b]{2,32}/",&#39;ج&#39;) );
echo &#39;<hr />&#39;;
var_dump( preg_match("/[\S\b]{2,32}/",&#39;中国&#39;) );

is not possible

You need to add a parameter u and read the code according to uniode

<?php
var_dump( preg_match("/[\S\b]{2,32}/u",&#39;ج&#39;) );
echo &#39;<hr />&#39;;
var_dump( preg_match("/[\S\b]{2,32}/u",&#39;中国&#39;) );
echo &#39;<hr />&#39;;
var_dump( preg_match("/[\S\b]{2,32}/u",&#39;Дракон&#39;) );
echo &#39;<hr />&#39;;
var_dump( preg_match("/[\S\b]{2,32}/u",&#39;cc&#39;) );

Thank you for reading, I hope it can help everyone, Thank you all for your support of this site!

The above is the entire content of this article, I hope it will be helpful to everyone's study.


Related recommendations:

php uses the preg_match() function to implement the method of verifying the ip address

php preg_matchMatch string length case analysis

PHP preg_match Detailed explanation of the steps for matching string length

#

The above is the detailed content of Detailed explanation of php preg_match matching examples of languages ​​in different countries. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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