我有一套URL验证方法,其效果良好,但这种通行证除外:“http://www.un.org”。 我愿保证,用户已经进入了像“
目前使用的Im模式是: 如果能帮助改变上述内容,以确保用户能够进入完整、有效的导游。"^(https?://)"
+ "?(([0-9a-z_!~* ().&=+$%-]+: )?[0-9a-z_!~* ().&=+$%-]+@)?" //user@
+ @"(([0-9]{1,3}.){3}[0-9]{1,3}" // IP- 199.194.52.184
+ "|" // allows either IP or domain
+ @"([0-9a-z_!~* ()-]+.)*" // tertiary domain(s)- www.
+ @"([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]." // second level domain
+ "[a-z]{2,6})" // first level domain- .com or .museum
+ "(:[0-9]{1,4})?" // port number- :80
+ "((/?)|" // a slash isn t required if there is no file name
+ "(/[0-9a-z_!~* ().;?:@&=+$,%#-]+)+/?)$"
Recently I discovered two amazing regular expression features: ?: and ?!. I was curious of other neat regex features. So maybe you would like to share some tricky regular expressions.