如何匹配任何地方都可能發生換行符的正則表達式?用換行符匹配正則表達式
例如,如果我想匹配「成千上萬只海龜蛋」,它應該匹配以下所有情況。 (甚至情況下,當換行符是裏面的話。)
Scientists have revealed that a mammoth effort to move *thousands of turtle eggs* from beaches around the Gulf of Mexico after the Deepwater Horizon oil spill may have saved almost 15,000 of the reptiles.
Scientists have revealed that a mammoth effort to move *thousands
of turtle eggs* from beaches around the Gulf of Mexico after the Deepwater Horizon oil spill may have saved almost 15,000 of the reptiles.
Scientists have revealed that a mammoth effort to move *thousands of
turtle eggs* from beaches around the Gulf of Mexico after the Deepwater Horizon oil spill may have saved almost 15,000 of the reptiles.
Scientists have revealed that a mammoth effort to move *thousands of turtle
eggs* from beaches around the Gulf of Mexico after the Deepwater Horizon oil spill may have saved almost 15,000 of the reptiles.
下一次,請向我們提供您正在使用的應用程序信息哪些regex庫,或者,因爲不同的庫/應用程序將使一個不同的正確答案。您也可以通過選擇多個適當的標籤來發出信號。 – Vantomex 2010-10-11 04:57:59
@Vantomex正則表達式庫很重要嗎?我可以用通用答案做,而不是綁定到任何圖書館/應用程序。 - 謝謝 – 2010-10-13 01:44:02
不是每個正則表達式lib都支持佔有量詞,原子分組等,它們可以用來優化庫的正則表達式解析速度。而且,他們有很多規則差異來實現正則表達式庫之間的相同結果。 – Vantomex 2010-10-13 01:53:51