Home >php教程 >php手册 >判断url的正则表达式

判断url的正则表达式

WBOY
WBOYOriginal
2016-06-13 09:41:281241browse

判断url的正则表达式

@"^((https|http|ftp|rtsp|mms)?://)"
+ @"?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@
+ @"(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL- 221.2.162.15
+ @"|" // 允许IP和DOMAIN(域名)
+ @"([0-9a-z_!~*'()-]+\.)*" // 域名- www.
+ @"([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名
+ @"[a-z]{2,6})" // first level domain- .com or .museum
+ @"(:[0-9]{1,4})?" // 端口- :80
+ @"((/?)|" // a slash isn't required if there is no file name
+ @"(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";

判断email的正则表达式
@"([a-zA-Z0-9_-])+(";

判断电话号码
@"(^0\d{2,3}\-?\d{7,8}$)|(^0?13\d{9}$)|(^0?15[0,8,9]\d{8}$)";//目前的电话号码

判断整数
@"^\d+$";

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