
1 manhere 2011-01-31 08:55:35 +08:00 “url 中含有”----作为参数也算吗? 最好判断下HOST。 |
2 zonovo OP 不用考虑 url 里特殊的符号,url 任何一部分包含 example.com 都能匹配就行。 匹配如:abc.example.com, www.example.com, www2.example.com/xyz/uvw, www.g.to/example.com 不匹配如: example2.com, okexample.com |
3 napoleonu 2011-01-31 09:40:09 +08:00 <a href="http://www.v2ex.com/t/7900#reply1">V2EX</a> <a href="Login?cOntinue=http://www.v2ex.com/t/7900#reply1/">V2EX</a> ".*http.*\.v2ex\.com\/.*" |
5 napoleonu 2011-01-31 10:00:46 +08:00 我是打醋的,要写出好的正则先要尽可能把你可能遇到的情况都列出来吧。 |
6 westy 2011-01-31 11:00:49 +08:00 |
7 leiyue 2011-01-31 12:43:43 +08:00 不知道你要什么,丢一个正则先,你看能用不。 Name: URL (load) Author: Sergio Sanz Group by:protocol port page query String wherePage (#) Pattern: /^(http|https)?(?:\:\/\/)?((?:[^\?#\/]+\.[^\?#\/]+))?(?::(\d+))?([^\?#]*)(?:\?([^#]*))(?:#(.*))$/ |