【发布时间】:2010-04-18 10:07:54
【问题描述】:
我有一个 URL 类型列表
-
http://www.example.com/pk/ca, -
http://www.example.com/pk, -
http://www.example.com/anthingcangoeshere/pk,和 -
http://www.example.com/pkisnotnecessaryhere。
现在,我只想找出那些以/pk 或/pk/ 结尾并且在.com 和/pk 之间没有任何内容的网址
【问题讨论】:
-
你的问题不是很清楚。给出更多你想要匹配和不想匹配的例子。
-
还不清楚。 URL 是否必须包含
.com? -
@Mark 是的,它应该包含
.com -
也许你的意思是“URLs that's path is
/pkor start with/pk/” or “URLs that's the first path segment ispk”? -
这是一个非常有用的学习正则表达式的页面:zytrax.com/tech/web/regex.htm