I encountered this situation to match, but each time I matched to the beginning of the repetition:
$file = ' Push_1113_20150105000052430.txt '; $file 2 = ' confirm_push_1114_20150105000052430.txt ';p reg_match ('/^ (get| push|admin). *.txt/', $file, $rs);p reg_match ('/^confirm.*.txt/', $file 2, $rs 2); Echo ' The result of
is:
array ([0] = push_1113_20150105000052430.txt [1] = = Push) array ([0] = confirm_push_1114_20150105000052430.txt)
You can see that the first result has a duplicate match to two push, what's going on??
How can I not know, I later various attempts, then changed to do so:
preg_match ('/^[get|push|admin].*.txt/', $file, $rs);
is to change the parentheses into brackets so that the result is:
array ([0] = push_1113_ 20150105000052430.txt)
Cause further search is needed, but it is not yet known, but it is certainly due to the difference between () and [].
The above describes the issue of regular expression matching causes duplicates, including the aspects of the content, want to be interested in PHP tutorial friends Helpful.