preg_match长度宽度高度

时间:2016-04-25 11:53:13

标签: php preg-match

我在php中打开一个csv文件,我确实有多行的列,如下所示:

1 | Some word 18x140x2000mm another word
2 | 20x150x300cm couple other words
3 | new words 30x140x2100mm

如何使用preg_match获取字符串中的长度,高度,宽度甚至单位cm,mm。

1 | $attributes = array(18, 140, 2000, mm);
2 | ...

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

你试试这个吗?

(\d+)x(\d+)x(\d+)(\w+)

如果它不起作用,请告诉我。