A
A
arsenaljek2020-09-17 12:45:44
PHP
arsenaljek, 2020-09-17 12:45:44

How to parse text that has no tags?

for example

<h1>кнопка без фиксации, металл 19мм., подсветка 12В.</h1><br>Код товара: 111055<br>

How to parse the product code here?
I usually use simple html dom parse but it doesn't work here

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stimulate, 2020-09-17
@arsenaljek

preg_match('/Код товара: ([0-9]+)/su',  '<h1>кнопка без фиксации, металл 19мм., подсветка 12В.</h1><br>Код товара: 111055<br>', $match);

print_r($match[1]);

I
Ilya, 2020-09-17
@New_Horizons

preg_match

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question