What does the ISU of Preg_match in PHP mean _php instance

Source: Internet
Author: User
Tags repetition

ISU is the meaning of the case, where s also does not include line breaks and U is reversed the number of matching numbers so that it is not the default repetition, presumably this is the individual we read the article.

Regular back/(. *)/isu, what does the "IsU" parameter mean?

This is the modifier in the regular.

I was looking for uppercase and lowercase letters at the same time,

S is a dot (.) Matches all characters, including line breaks. If S is not set, the line break is not included.

You are reversing the matching number of values so that it is not the default repetition, and becomes followed by the "?" only to be repeated.

Cases

Preg_match-compatible Regular expression syntax B is the word boundary

So: The following should be OK???

$a = "TEST,ADMIN,ABC";
$b = "TE";
$exist =preg_match ("/b{$b}b/", $a);
if ($exist)
{
echo "exists";
} else
{
echo "does not exist";
}

Take a look at the relevant instructions

Copy Code code as follows:

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

Preg_match () returns the number of times the pattern was matched. Either 0 times (no match) or 1 times, because Preg_match () stops the search after the first match. Preg_match_all () on the contrary, will search until the end of the subject. If error Preg_match () returns false.

Example:

<?php
$a = "Abcdefgabcdefaaag";
Preg_match (' |abc ([a-z]+) G|isu ', $a, $out 1);
Preg_match_all (' |abc ([s]+) G|isu ', $a, $out 2);
echo "<pre>";
Print_r ($out 1);
Print_r ($out 2);
echo "</pre>";
? >

Writing:

Use double quotes in the same time as single quotes

<?php
preg_match_all ("/href=" (. *) "/isu", $contents, $out);
Preg_match_all (' |href= ' (. *) "|isu", $contents, $out);
>

The above content is small make up for you to explain the PHP in the Preg_match ISU mean, I hope you like.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.