【发布时间】:2011-05-24 22:05:57
【问题描述】:
我有以下网址:
http://example.com/product/1/something/another-thing
虽然也可以:
http://test.example.com/product/1/something/another-thing
或
http://completelydifferentdomain.tdl/product/1/something/another-thing
我想使用 Javascript 从 URL 中获取数字 1(id)。
唯一不变的是/product。但我还有一些其他页面,其中 url 中也有 /product,只是不在路径的开头。
正则表达式会是什么样子?
【问题讨论】:
标签: javascript regex match