0

我只想在字符串中间匹配一次重复字符(/)。一开始它必须是http://www.website/shop。现在我正在使用这段代码,它匹配所有的 html。我该如何限制它。

'^[http://www.website/shop/].*.html$'

使用这个正则表达式,没有结果 ^[http://]\W*(/){2}\W

有效的

   http://www.website/shop/men.html
   http://www.website/shop/women.html

无效的

   http://www.website/shop/men/footwear.html
   http://www.website/shop/men/causal.html
   http://www.website/shop/women/footwear.html
4

1 回答 1

1

这个正则表达式应该工作

"http://www.website/shop/\w*.html"

...如果在斜线之后还有另一个斜线,它将不匹配.../shop/

于 2013-03-28T01:12:11.003 回答