我试图用正则表达式匹配下面的路径。
# test-site could be anything like "shoe-site", "best-clock", etc.
/content/test-site
当前的正则表达式规则(\/content\/{1}\S+)就足够了。
问题是它匹配整个路径,例如/content/test-site/en_US/abc.html.
我只需要匹配/content/test-site.
要匹配的路径示例:
https://localhost:4502/content/test-site/en_US/book/city/sample-rooms/airport-inn/propertyCode.00000.html
到目前为止我尝试过的正则表达式;
(\/content\/[a-z-]+)\/[a-z]{2}_[A-Z]{2}\/book(ing-path)?\/(sample-|sample-details)(.*).[0-9]{5}.*
/content/test-site is optional- it might not present sometimes in url.
我做错了什么,我该如何解决?
陪伴而非守候
蝴蝶不菲
开心每一天1111
相关分类