What does isU of preg_match in php represent?

墨辰丷
Release: 2023-03-30 11:08:02
Original
2117 people have browsed it

This article mainly introduces the meaning of isU of preg_match in php. Interested friends can refer to it. I hope it will be helpful to everyone.

isU means case separation, s here does not include the newline character, and U reverses the value of the number of matches so that it is not a default repetition. This is probably the case when we read the article.

/(.*)/isU after the regular expression, what does the "isU" parameter mean?

This is the modifier in the regular expression.

i searches for both uppercase and lowercase letters, and

s is a dot (.) that matches all characters, including newlines. If If s is not set, the newline character is not included.

U reverses the value of the number of matches so that it is not repeated by default, but becomes repeated when followed by "?"

Example

preg_match In the compatible regular expression syntax, b represents the word boundary

So: The following should be possible? ? ?

$a="test,admin,abc";
$b="te";
$exist=preg_match("/b{$b}b/",$a);
if($exist)
{
echo "存在";
}else
{
echo "不存在";
}
Copy after login

Look at the relevant instructions

Copy code The code is as follows:


int preg_match ( string pattern, string subject [, array matches [ , int flags]] );

preg_match() returns the number of times pattern is matched. Either 0 times (no match) or 1 time, since preg_match() will stop searching after the first match. preg_match_all(), on the contrary, will search until the end of subject. preg_match() returns false on error.

Example:

<?php
$a = "abcdefgabcdefaaag";
preg_match(&#39;|abc([a-z]+)g|isu&#39;,$a,$out1);
preg_match_all(&#39;|abc([s]+)g|isu&#39;,$a,$out2);
echo "<pre class="brush:php;toolbar:false">";
print_r($out1);
print_r($out2);
echo "
"; ?>
Copy after login

Writing:

The difference between using double quotes and single quotes

<?php
preg_match_all("/href="(.*)"/isu",$contents,$out);
preg_match_all(&#39;|href="(.*)"|isu&#39;,$contents,$out);
?>
Copy after login

Summary: The above is the text The entire content of this article is hoped to be helpful to everyone's study.

Related recommendations:

The function of ZipArchive function in php

php implements batch processing to detect whether the page has been Functions included in Baidu

Calendar program implemented in php

The above is the detailed content of What does isU of preg_match in php represent?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!