我需要幫助解決正則表達式(PCRE)。我想從下面的多個網址中提取hello-world
部分。我得到這個至今:我如何正則表達式網址的一部分
^/news/(.*?)/$
https://www.example.com/news/2017-08-09/hello-world/topics/
https://www.example.com/news/2017-08-09/hello-world/gallery/
https://www.example.com/news/2017-08-09/hello-world/
但這捕捉2017-08-09/hello-world/topics
,我只需要hello-world
這是什麼規則?請制定要求。 –
如果我明白了,並且想知道哪些網址包含hello-world,爲什麼不用'hello-world'作爲模式呢? – Igle
是否存在阻止您僅僅執行'/ hello-world /'的要求? – Bic