Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to use PHP regular expressions to get integers from strings
How to use PHP regular expressions to get integers from strings
Pregnancy _ matching _ all methods

Preg _ match _ all- Global Regular Expression Matching Description Intpreg _ match _ all (String pattern, string subject, array matches [,int flags]) searches for all the contents that match the regular expression given by the pattern in the topic, and puts the results into the matching items in the order specified by the flag. When the first match is found, the next search starts at the end of the previous match. The flag can be a combination of the following tags (note that the combination of PREG_PATTERN_ORDER and PREG_SET_ORDER is meaningless): PREG_PATTERN_ORDER sorts the results so that $matches[0] is an array of all patterns, $matches[ 1] is an array of strings whose sub-patterns match in the first bracket, and so on. & lt? PHP preg _ match _ all(" | & lt; 【^>; ]+& gt; (.*)& lt; /[^>; ]+& gt; |U ","& lt/b & gt; Example:</b > & ltdiv align = left & gt This is a test & lt/div >;; " ,$out,PREG _ PATTERN _ ORDER); Print $out[0][0]. ", ".$out[0][ 1]。 ”\ n”; Print $out[ 1][0]. ", ".$out[ 1][ 1]。 ”\ n”; ? & gt

From: /view/2 122394.htm? fr=ala0_ 1_ 1

The problem according to LZ is

preg_match_all ("|\d+|U ",$str,$out,PREG _ PATTERN _ ORDER);

The final matching result is in the array of $out[0]