开发者

Regular expression for removing the page part of a url

Can someone show me a regex that will remove the page part from a string.

My strings are either

/section/ 
/section/page.html
/section/subsection/page.html

I need a regexp that would return

/section/
/section/
/section/su开发者_运维技巧bsection/

You can assume the file ext is always .html and the strings are relative (no http://host:port)

Thanks!


I think you're looking for:

/(.*/)+
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜