Home >Backend Development >PHP Tutorial >Regular expression to determine url_PHP tutorial
@"^((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+$";