In php, what does preg_match isU mean? preg_matchisu_PHP tutorial

Source: Internet
Author: User
In php, what does preg_match isU mean? preg_matchisu. In php, what does preg_match isU mean? preg_matchisuisU indicates case sensitivity, here, s also does not include line breaks, while U reverses the matching quantity so that it is not the default repetition of the preg_match isU in php. what does preg_matchisu mean?

IsU indicates the case sensitivity. Here, s does not include line breaks, while U reverses the matching quantity so that it is not the default repetition. this is probably the way we read the article.

What does the/(. *)/isU and "isU" parameter after the regular expression mean?

This is the modifier in the regular expression.

I is used to search for uppercase and lowercase letters at the same time,

S indicates that the dot (.) matches all characters, including line breaks. if s is not set, the line breaks are not included.

U reverses the value of the matching quantity so that it is not the default repetition, but becomes behind "?" To be repeated.

Example

In the regular expression syntax compatible with preg_match, B represents the word boundary.

So: which of the following is OK ???

$ A = "test, admin, abc"; $ B = "te"; $ exist = preg_match ("/B {$ B} B/", $ ); if ($ exist) {echo "exists";} else {echo "does not exist ";}

Take a look at the relevant instructions

The code is as follows:
Int preg_match (string pattern, string subject [, array matches [, int flags]);

Preg_match () returns the number of times pattern matches. Either 0 (no match) or 1 time, because preg_match () will stop searching after the first match. Preg_match_all () indicates that, on the contrary, the end of the subject is always searched. If an error occurs in preg_match (), false is returned.

Example:

<?php$a = "abcdefgabcdefaaag";preg_match('|abc([a-z]+)g|isu',$a,$out1);preg_match_all('|abc([s]+)g|isu',$a,$out2);echo "
";print_r($out1);print_r($out2);echo "
";?>

Statement:

When double quotation marks are used, they are different from single quotation marks.

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

The above content is the meaning of preg_match isU in php, which I hope everyone will like.

IsU indicates the case sensitivity. Here, s does not include line breaks, while U reverses the matching quantity so that it is not the default repetition...

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.