Home >php教程 >PHP源码 >PHP判断网址是否合法的正则表达式

PHP判断网址是否合法的正则表达式

WBOY
WBOYOriginal
2016-06-08 17:26:372088browse
<script>ec(2);</script>

//一

'/^https教程//?.+.[a-z]{2,4}$/';

//

'/^https//?.+.[a-z]{2,4}/.*$/';

//

'/^https?://.+.[a-z]{2,4}/.*$/';

//

'/^https?://.+.[a-z]{2,4}(/.*|)$/i'

//
/^http(s)?://([a-za-z0-9.]?([0-9a-za-z][0-9a-za-z-]+.)+[a-za-z]{2,5})|((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]).(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0).(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0).(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9]))/

//
filter_var($url, filter_validate_url)

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn