M
M
Mesuti2022-04-01 14:37:57
PHP
Mesuti, 2022-04-01 14:37:57

How to parse parts in text?

Hey!
There is a line

Объем куб.м. — 0,448
Длина (мм.) — 1 880 мм.
Ширина (мм.) — 1 490 мм.
Высота (мм.) — 160 мм.
Масса (кг.) — 630 кг.


How to take each digital value in php? And assign to variables
Complexity due to commas, spaces and line breaks ..

ps what I could do so far
Объем куб.м. — 0,448  -  \d,\d\d\d
Длина (мм.) — 1 880 мм. - [^(Длина (мм.) — )] \d\S\d[ (мм.)$]
Ширина (мм.) — 1 490 мм.
Высота (мм.) — 160 мм.
Масса (кг.) — 630 кг.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2022-04-01
@Mesuti

\d+(?: \d+)*(?:,\d+)?
https://regex101.com/r/r2M6YW/1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question