我有一個字符串(從文件):php preg_match非貪婪?
ILX (New for 2013!)
Overview: The least expensive route to Honda's premium-label goodness
Drivetrain: Two four-cylinder engines to choose from as well as a gas-electric hybrid; front-wheel-drive only.
我如何得到字符串:
$writeup = file_get_contents($car_files_path . $manufacture . '/Stories/'.$story);
我想匹配概述線(Overview: The least expensive route to Honda's premium-label goodness)
什麼是實現這一目標的最佳途徑。
我試過了。* \ n,但會匹配一切,然後一個新行。有沒有一種方法,使正則非貪婪?
我公頃已經試過: preg_match('/^Overview:\s.*$/im', $writeup, $overall_matches)
,我沒有得到任何比賽
非貪婪是'。*?'http://www.regular-expressions.info/repeat.html – 2013-02-19 21:12:11
我有點困惑你想匹配..只是用整條線是什麼單詞'Overview'在裏面,換行符?什麼是你的實際正則表達式? – 2013-02-19 21:12:15
我試圖用概述整條生產線相匹配: – 2013-02-19 21:12:44