我有这些数据:
49780|Truck|2010|FORD|F-250 SUPER DUTY PICKUP|CABELAS|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2008|FORD|F-250 SUPER DUTY PICKUP|FX4|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2009|FORD|F-250 SUPER DUTY PICKUP|FX4|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2010|FORD|F-250 SUPER DUTY PICKUP|HARLEY-DAVIDSON EDITION|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2010|FORD|F-250 SUPER DUTY PICKUP|KING RANCH|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2008|FORD|F-250 SUPER DUTY PICKUP|LARIAT|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2009|FORD|F-250 SUPER DUTY PICKUP|LARIAT|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2010|FORD|F-250 SUPER DUTY PICKUP|LARIAT|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2008|FORD|F-250 SUPER DUTY PICKUP|XL|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2009|FORD|F-250 SUPER DUTY PICKUP|XL|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2010|FORD|F-250 SUPER DUTY PICKUP|XL|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2008|FORD|F-250 SUPER DUTY PICKUP|XLT|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2009|FORD|F-250 SUPER DUTY PICKUP|XLT|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2010|FORD|F-250 SUPER DUTY PICKUP|XLT|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2010|FORD|F-350 SUPER DUTY PICKUP|CABELAS|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2008|FORD|F-350 SUPER DUTY PICKUP|FX4|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2009|FORD|F-350 SUPER DUTY PICKUP|FX4|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2010|FORD|F-350 SUPER DUTY PICKUP|HARLEY-DAVIDSON EDITION|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2010|FORD|F-350 SUPER DUTY PICKUP|KING RANCH|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2008|FORD|F-350 SUPER DUTY PICKUP|LARIAT|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2009|FORD|F-350 SUPER DUTY PICKUP|LARIAT|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2010|FORD|F-350 SUPER DUTY PICKUP|LARIAT|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2008|FORD|F-350 SUPER DUTY PICKUP|XL|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2009|FORD|F-350 SUPER DUTY PICKUP|XL|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2010|FORD|F-350 SUPER DUTY PICKUP|XL|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2008|FORD|F-350 SUPER DUTY PICKUP|XLT|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2009|FORD|F-350 SUPER DUTY PICKUP|XLT|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
49780|Truck|2010|FORD|F-350 SUPER DUTY PICKUP|XLT|6.4L DIESEL V8|||Crew Cab w/81.8 in./6 ft. 9.8 in. Bed|Extended Cab w/81.8 in./6 ft. 9.8 in. Bed
我使用RegExr编写了这个正则表达式。它捕获第5列(由|分隔),如果该行匹配:
.*\|.*\|2010\|ford\|(.*)\|.*\|.*\|.*\|.*\|.*\|.*
当我在其上运行preg_match_all时,我收到此错误:
preg_match_all() [<a href='function.preg-match-all'>function.preg-match-all</a>]: Unknown modifier '*'
答案 0 :(得分:3)
请务必使用delimiters,看起来您还想要case insensitive匹配:
$matches = array();
preg_match_all('/.*\|.*\|2010\|ford\|(.*)\|.*\|.*\|.*\|.*\|.*\|.*/i', $subject, $matches);