I am struggling to find a solution using preg_match_all to get from the following text only the value and the measurements untis , e.x. texts
MAN CAB HDMI TO HDMI M/M 18 cm SHIELDED 1.3V BLK
MAN CAB HDMI TO HDMI M/M SHIELDED 1.3V BLK 18cm
MAN CAB HDMI TO HDMI M/M SHIELDED 1.3V BLK 5M
MAN CAB HDMI TO HDMI 5 M M/M SHIELDED 1.3V BLK
MAN CAB HDMI TO HDMI M/M SHIELDED 1.3V BLK 5.0 m
MAN CAB HDMI TO HDMI M/M SHIELDED 1.3V BLK 5.2m
MAN CAB HDMI TO HDMI 5,2m M/M SHIELDED 1.3V BLK
MAN CAB HDMI TO HDMI M/M 5,2 m SHIELDED 1.3V BLK
would like to get as results
18 cm,18cm,5M,5 M,5.00 M,5.0 mm,5.2m and 5,2m
Something like this should work:
The
misflags make the regular expression case insensitive and allows matching over newlines.