Php regular expression match a text paragraph is very simple 60 points PHPcode & lt; spanclass = & quot; ball-type-1 & quot; & gt; php regular expression match a text paragraph is very simple 60 points
PHP code
1 2 3 4 5
Match the numbers 1, 2, 3, 4, and 5.
Thanks for online refresh, etc.
------ Solution --------------------
$ Str = <
1
2
3
4
5
Html;
Preg_match_all ('# (.*)# IsU ', $ str, $ arr );
Print_r ($ arr [1]);
------ Solution --------------------
Preg_match_all ('# (\ D +)# IsU ', $ str, $ arr );
------ Solution --------------------
I: in-casesensitive, which is case insensitive.
S: PCRE_DOTALL, indicating that the DOT can match the line break.
U: PCRE_UNGREEDY, non-greedy, equivalent to. *? in perl/python .*?, During the matching process, if A. * regular expression matches, it is executed immediately, instead of waiting for. * to consume all characters and then one-to-one rollback.
------ Solution --------------------
PHP code
1 2 3 4 5 html;preg_match_all('#(\d+)#i', $str, $arr);print_r($arr[1]);