Use of preg regular function in PHP
the difference between 1.preg_match and Preg_match_all
The difference between Preg_match and Preg_match_all is that preg_match matches only once. The Preg_match_all all match until the end of the string. Cases:
Demo Code
Operation effect (Figure 1)
Operation effect (Figure 2)
Main Package function
Multi_process ();According to the parameters, create the number of pointers to the child process.Bright spot Function 1: The
In Data acquisition and page analysis, often need to crawl the content of a given URL page, or the second, third level depth page content.
Here is a test example implementation, for reference only.
The code is as follows:
/*Match a given page
Preface
PHP is widely used in the background CGI development of the web, usually after the user data data to obtain a certain result, but if the user input data is incorrect, there will be problems, such as someone's birthday is "February 30"! What
Note: modify and update at http://www.discuz.net/thread-1465174-1-1.html#, and add 56.com. Can download the latest version, http://pan.baidu.com/netdisk/singlepublic here? FID = 156737_3291021664
Plugin description
Function:
Displays videos shared
Use regular expressions in C
If you are familiar with SED, awk, grep, or VI in Linux, the concept of regular expressions is certainly not unfamiliar. Because it can greatly simplify the complexity of processing strings, it has been applied in many
The PHP regular expression extracts the href address from the html hyperlink. Sometimes we need to filter or extract external links of html strings. next I will introduce an href address program that uses PHP regular expressions to extract the href
HTML2pdf converts html to html, and the images in html are lost. there is no pdf in html, but I use regular expressions to replace the images and insert them into the image $ pattern & lt; img .*? Src [|] (. *? (? : 2.16.gif |. jpg |. png]) [|]. *? [
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.