PHP preg_replace to get a word after space, which is where it a word KG

I have a string that is uncertain,I have the following strings:
ST,NT,+ 16KG ~YT,NT,+ 16KG
ST,NT) 16KG +YT,N,+ 16KG
ST,NT,+ 16KG and etc.

My question is there any regex only take 16KG or 16, because the string output from digital scale.
I’m working on an application with serial port, so I can not parsing the data there, while in the output on digital scale tool is only 16KG.

Leave a Reply


Hire Me
Follow Me!
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.