我有一個正則表達式的問題網址 - 我有網址的4個例子:Python的正則表達式 - 排除包含一個字
http://auto.com/index.php/car-news/12158-classicauto-cup-2016-photo
http://auto.com/index.php/car-news/11654-battle-royale-2014
http://auto.com/index.php/tv-special-news/10480-new-film-4
http://auto.com/index.php/first/12234-new-volvo-xc60
我想用「TV-特殊新聞」中或「照片排除網址' 最後。
我已經試過:
http://(www.)?auto.com/index.php/(?!(tv-special-news)).*/[a-zA-Z0-9\-]{1,}-(?!photo)
,但它並不完全工作,我想
我認爲你可以做到這一點沒有正則表達式,在url'使用'「TV-特殊新聞」和'.endswith' –
不幸的是我需要的正則表達式:) –