regular expression extract text between tags

0

Good I'm trying to get what is between the tags <!--producto--><!--endproduct-->

$texto = <<<str
<!--product:id15-->
-Producto: Lentes C1
    -Marca: 'Traffic'
    -Color: 'Red'
<!--end-->
str;

I tried to do it with regular expressions:

preg_match('/<!--product:(.+?)-->[\s\S](.+)[\s\S]*<!--endproduct-->.*/', $texto, $match);

but I get all the text until the comments tags I only want the text that is inside

-Producto: Lentes C1
    -Marca: 'Traffic'
    -Color: 'Red'
    
asked by jsstoni 09.11.2018 в 19:34
source

0 answers