PHP Regular Function Learning

Source: Internet
Author: User
<?php/** * PHP regular function Learning *  * The original ereg and EREGI functions have been discarded, the current version with Preg_match instead of *  * Preg_match in the general use of the process to give three parameters, itself returns whether the match to the result 0 1. The third parameter is an array that matches the string to the array. * It matches until after the match is not continued, *  * Preg_match_all matches to continue to match, returns the total number of matches, and the array contains all the matching strings. *  * Ignore case not alone to function, after the regular string with I *  * PHP's regular need to use//include * * *  Regular replacement: Preg_replace  generally give three parameters, return the replaced string. *  * *  /$str = ' JL history hi '; $s = preg_match_all ('/hi/i ', $str,  $matches);//Ignore case, match to the number of times $s  , The matched string is put into $matches//var_dump ($matches);//var_dump ($s); $ss = preg_replace ('/hi/i ', ' hello ', $str); Var_dump ($SS);? >

  

PHP Regular Function Learning

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.