我在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 | ...
感谢您的帮助!
答案 0 :(得分:1)
你试试这个吗?
(\d+)x(\d+)x(\d+)(\w+)
如果它不起作用,请告诉我。