[Regular] why is this write effective? This post was last written by php441914320 at 2012-12-1012:28:48 hours): I wrote this: ^w+.rar $ | ^ w+.zip $ | ^ w+.7z $ I, but later I found that this write can also be: invalid w+.rar | [regular] why does this write work?
This post was last edited by php441914320 at 12:28:48 on
Matching compressed package file name (x.rar x.rar x.7z ):
I wrote this:
'/^ \ W + \. rar $ | ^ \ w + \. zip $ | ^ \ w + \. 7z $/I'
But later I found that this write can also be:
'/^ \ W + \. rar | zip | 7z $/I'
The symbol "|" is not in place. please advise.
The second regular expression should be executed as follows:
For example, I have already named the compressed package test.rar"
The first match: “test.rar "is a failure.
Second match: it should match "zip", but why does it match "^ \ w + \. zip $ "?
------ Solution --------------------
It is best to read the file header information and check the file authenticity on the server side ~
Reference:
Reference: We recommend a function, pathinfo ();
PHP code? 1/^ \ w + \. (rar
------ Solution --------------------
Zip
------ Solution --------------------
7z) $/I
So there is no problem in writing it. o (character _ Blank) o haha.