我試圖讓64-birmingham
出簡單的正則表達式讓我想尖叫
... name="title" /> <link href="http://www.domain.com/cities/64/deals/147943-local-coupon-book" rel="canonical" /> <meta content="text/html; charset=utf-8" http-equiv="Content-type" /> <link href="/deals/images/mobile/apple-touch-icon.png" rel="apple-touch-icon" /> <link href="http://www.domain.com/cities/64-birmingham.atom" rel="alternate" title="Birmingham, AL" type="application/atom+xml" />...
與此正則表達式
preg_match('#//www\.domain\.com/cities/(.+?)\.atom#is', $response, $slug);
它保持回升64/deals/147943-local-coupon-book" rel="canonical" />