Exclusive: PHP's URL verification regular algorithm, the most powerful in history after years of accumulation, gradually improved the written url verification algorithm functionisUrl ($ s) {returnpreg_match ('/^ http [s]? :\/\/'. '([0-9] {1, 3 }\.) {3} [0-9 Exclusive: php url verification regular algorithm, the most powerful
After years of accumulation, the url verification algorithm is gradually improved.
Function isUrl ($ s) {return preg_match ('/^ http [s]? :\/\/'. '([0-9] {1, 3 }\.) {3} [0-9] {1, 3 }'. // URL in IP format-199.194.52.184 '| '. // allow IP and DOMAIN (DOMAIN name) '([0-9a-z _! ~ * \ '()-] + \.) *'. // Third-level domain verification-www. '([0-9a-z] [0-9a-z-] {0, 61 })? [0-9a-z] \. '. // second-level domain verification '[a-z] {2, 6 })'. // top-level domain verification. com or. museum '(: [0-9] {1, 4 })? '. // Port-: 80 '((\/\?) | '. // If a file is contained, verify the file' (\/[0-9a-zA-Z _!~ \*\'\(\)\.;\? : @ & =\+ \ $, % #-\/] *)?) $/', $ S) = 1 ;}
If you still have problems, please paste the problematic url to continue to improve