简体   繁体   English

仅匹配 2 级深页面

[英]Match only for 2 level deep pages

So need to match for only pages ending with .html down two levels deep.所以只需要匹配以 .html 结尾的两层深的页面。

match比赛

http://www.example.com/bedroom/beds/select-queen-platform-bed.html

not match不匹配

http://www.example.com/bedroom/select-queen-platform-bed.html
http://www.example.com/bedroom/
http://www.example.com/
http://www.example.com/bedroom/beds/level3/select-queen-platform-bed.html

so basically it should match domain-name.com/level-1/level-2/page-name.html所以基本上它应该匹配 domain-name.com/level-1/level-2/page-name.html

The expression I have now doesn't match for some of these possibilities.我现在的表达与其中一些可能性不匹配。 What should I use?我应该使用什么?

current regex当前正则表达式

/*/.*html$

Try this:尝试这个:

^http:\/\/(?:(?:[^\/]+)\/){3}[^\/]+\.html$

Explanation解释

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM