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)