Perl compatible formal expression function library: Preg_match_all

Source: Internet
Author: User
Keywords Perl compatibility PHP Chinese function Manual Preg_match_all regular expression function library
Tags aliyun array data data processing example examples expression function

Preg_match_all

String integer alignment parsing.

Syntax: int preg_match_all (string pattern, string subject, array matches, int [order]);

return value: Integer

Function type: Data processing
&http://www.aliyun.com/zixun/aggregation/37954.html ">NBSP;
Content Description

This function parses the string subject with the rule of pattern. The value returned by the result is placed in the array parameter matches and sorted according to the ordinal value order. The value of the parameter order has Preg_pattern_order and preg_set_order two kinds. If there is no order value, the system is automatically preg_pattern_order to the form. The return value is the number of results that conform to the comparison, and returns a value of False if there is no or error.

Usage examples

Examples of Preg_pattern_order

<?php
Preg_match_all ("|<[^>]+> (. *) </[^>]+>| U "," <div align=left>a test</div> ", $out, Preg_pattern_order);
Print $out [0][0]. ",". $out [0][1]. " \ n ";
Print $out [1][0]. ",". $out [1][1]. " \ n "
?>

The return value is

<b>example: </b>, <div Align=left>this is a test</div>
Example:, this is a test

Examples of Preg_set_order

<?php
Preg_match_all ("|<[^>]+> (. *) </[^>]+>| U "," <div align=left>a test</div> ", $out, Preg_set_order);
Print $out [0][0]. ",". $out [0][1]. " \ n ";
Print $out [1][0]. ",". $out [1][1]. " \ n "
?>

The return value is

<b>example: </b>, Example:
<div Align=left>this is a test</div>

Related Article

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.