<?php
$zz = '/Audi*/';
##$string = "Audi 2500 is my favorite Love";
if(preg_match($zz, $string, $matches)){
echo 'Matched, the result is: '; var_dump($matches);}else{ echo 'No match';}? >Why is the output result 'Audi' instead of 'Audi Audi' or 'Audi Di'? Isn't * at least 0 times? How come not all of them were extracted in two cases?又白又帅又可爱2017-11-20 12:15:33
Using preg_match should match "Audi", using preg_match_all should match "Audi Audi",
This is a theoretical result, but in fact I have not seen any examples of regular matching in Chinese. Regular It can only check whether it is Chinese and has a limited length, and it uses Chinese bytecode, similar to this: u4e00-u9fa5
路过2017-11-18 10:27:36
preg_match only matches one
preg_match_all is the entire matching result
It is recommended to check the manual