Home > Backend Development > PHP Tutorial > Regular expression to determine url_PHP tutorial

Regular expression to determine url_PHP tutorial

WBOY
Release: 2016-07-13 10:36:39
Original
975 people have browsed it

Regular expression to determine url

@"^((https|http|ftp|rtsp|mms)?://)"
+ @"?(([0-9a-z_!~*'().&=+$ %-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp user@
+ @"(([0-9 ]{1,3}.){3}[0-9]{1,3}" // URL in IP form- 221.2.162.15
+ @"|" // IP and DOMAIN (domain name) are allowed
+ @"([0-9a-z_!~*'()-]+.)*" // Domain name - www.
+ @"([0-9a-z][0-9a- z-]{0,61})?[0-9a-z]." // Second-level domain name
+ @"[a-z]{2,6})" // first level domain- .com or . museum
+ @"(:[0-9]{1,4})?" // port - :80
+ @"((/?)|" // a slash isn't required if there is no file name
+ @"(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";

Regular expression to judge email
@"([a-zA-Z0-9_-])+(";

Judge phone number
@"(^0d{2,3}-?d{7,8}$)|(^0?13d{9}$)|(^0?15[0,8 ,9]d{8}$)";//Current phone number

Judge integers
@"^d+$";

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/738509.htmlTechArticleRegular expression to judge url@"^((https|http|ftp|rtsp|mms)?:/ /)" + @"?(([0-9a-z_!~*'().=+$%-]+: )?[0-9a-z_!~*'().=+$%- ]+@)?" //ftp user@ + @"(([0-9]{1,3}.){3}[0-9]{1,3}" // IP form...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template