- Preg_match_all ("|<[^>]+> (. *) ]+>| U "," a Test ", $out, Preg_pattern_order);
- Print $out [0][0]. ",". $out [0][1]. " n ";
- Print $out [1][0]. ",". $out [1][1]. " N
- ?>
Copy Code3,preg_replace parse and replace the string comparison. Syntax: Mixed preg_replace (mixed pattern, mixed replacement, mixed subject); Return value: Mixed type data Function type: Data processing Description: This function parses the subject string with the rule of pattern, and the string to be replaced is the parameter replacement. The return value is a mixed-type data, which is substituted for the string result. Using the example, the following example returns a value of $startDate = 6/19/1969.
- $patterns = Array ("/(19|20d{2})-(d{1,2})-(d{1,2})/", "/^s*{(w+)}s*=/");
- $replace = Array ("3/4/1", "$ =");
- Print Preg_replace ($patterns, $replace, "{startdate} = 1969-6-19");
- ?>
Copy Code4,preg_split the string according to the specified rule. Syntax: Array preg_split (string pattern, string subject, int [limit]); return value: Array Function type: Data processing Description: This function separates strings according to the specified rules. The return value after the cut is an array variable. The parameter pattern is the specified rule string, the parameter subject is the string to be processed, and the parameter limit can be omitted, indicating the maximum value to be processed. |