Home > Backend Development > PHP Tutorial > What does isU of preg_match in php mean? preg_matchisu_PHP tutorial

What does isU of preg_match in php mean? preg_matchisu_PHP tutorial

WBOY
Release: 2016-07-12 09:07:56
Original
1028 people have browsed it

What does isU of preg_match in php mean? preg_matchisu

isU means case split. Here, s does not include newlines and U reverses the number of matches. The value makes it not a default duplication, which 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 regular expressions.

i searches for uppercase and lowercase letters simultaneously,

s is a dot (.) matching all characters, including newlines. If s is not set, newlines are 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

In preg_match compatible regular expression syntax, b represents word boundary

So: The following should be OK? ? ?

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

<&#63;php
$a = "abcdefgabcdefaaag";
preg_match('|abc([a-z]+)g|isu',$a,$out1);
preg_match_all('|abc([s]+)g|isu',$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

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

The above content is what the editor explains to you about the meaning of isU of preg_match in php. I hope you like it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1058156.htmlTechArticleWhat does the isU of preg_match in php mean? preg_matchisu isU means uppercase and lowercase. If there is another s here, it will not. Including the newline character and U reverses the value of the number of matches so that it is not the default repeat...
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