0
更換網頁的meta描述撇我有這樣的數據:正則表達式使用的preg_match
<meta name="description" content="Access Kenya is Kenya's leading corporate Internet service provider and is a technology solutions provider in Kenya with IT and network solutions for your business.Welcome to the Yellow Network.Kenya's leading Corporate and Residential ISP" />;
我使用這個正則表達式:
<meta +name *=[\"']?description[\"']? *content=[\"']?([^<>'\"]+)[\"']?
爲了讓網頁說明所有工作正常,但一切都攤處處有是一個撇號。
我該如何逃避?
...如果該屬性值由單引號包裹,你將有相同匹配雙引號的問題,對嗎?看看[這個答案](http://stackoverflow.com/a/1732454/3294262) – fusion3k
此外,你認爲沒有引號的元(不可能)選項。 [看看在這種情況下會發生什麼](https://regex101.com/r/hQ1gB0/1)。 – fusion3k
@ fusion3k我有一個備用計劃,無論如何,謝謝你 –